home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Precision Software Appliβ¦tions Silver Collection 4
/
Precision Software Applications Silver Collection Volume 4 (1993).iso
/
database
/
sr_manul.exe
/
PART1
next >
Wrap
Text File
|
1990-04-22
|
215KB
|
7,083 lines
SR-Info/VP-Info
Command and Function
Reference Manual
by Sidney L. Bursten and Bernard Melman
for
Sub Rosa Publishing Inc.
1990 Edition
The next best thing to knowing something
is knowing where to find it.
- Dr. Samuel Johnson (1709-1784)
First printing
April, 1990
Copyright (c) 1990 Sub Rosa Publishing Inc.
Unit 18-1170 Sheppard Ave. West.
Downsview, ON, Canada M3K 2A3
Phone: (416) 398-8414
Fax: (416) 630-7384
Incorporating material previously published in
MAX and VP-Info manuals, Copyright (c)
1984, 1985, 1986, 1989 Sub Rosa Inc.
SR-Info/VP-Info Copyright (c) 1984, 1985,
1986, 1987, 1988, 1989, 1990 Sub Rosa Inc.
Trademarks:
SR-Info is a trademark of Sub Rosa Publishing Inc.
dCOMP and MAX are trademarks of Sub Rosa Inc.
Sub Rosa Publishing Inc. is an authorized user of
the VP-Info trademark, a trademark of Paperback
Software International
dBASE, dBASE II, dBASE III, dBASE III+ and dBASE IV
are trademarks of Ashton-Tate
IBM is a trademark of IBM Corporation
10 9 8 7 6 5 4 3 2 1
INTRODUCTION
VP-Info, with its new offspring SR-Info, was the first and, we
believe, is still the best compiled data base management language
designed for IBM-compatible DOS computers.
SR-Info/VP-Info (which, for the balance of this manual, will be
called just Info when referring generally to all versions of the
language) shares many of the language features and keywords of the
popular dBASE family of languages, so dBASE users can learn it in a
matter of hours, but has many novel features resulting in very fast
program execution and much reduced programming time.
If this is your first exposure to Info, you may wish to put this
manual aside for a while and take it for a "test drive" with the help
of the brief instructions in the file FASTART on the distribution
disk. But don't forget to come back to the full manual to take
advantage of the full power and versatility of Info.
This release of the language represents its fifth major revision
and enhancement since its original publication by Sub Rosa Inc. in
1984 under the name dCOMP. Sub Rosa Inc. published a major upgrade
under the name MAX in 1985, which in turn was followed in 1986 by
Paperback Software International's publication of a major new version
of the language under its own name, VP-Info.
Paperback issued a major upgrading in 1988 and a brand new
version (2.0) in 1989, followed by this enhanced new version by Sub
Rosa Publishing Inc. in 1990.
Our goal at Sub Rosa Publishing Inc. is to provide you, the user,
with the finest database management tool . . . one that will continue
to grow in power and utility through the coming years. You can help
us achieve this goal in various ways.
First of all, Info is a rich language with many useful features.
To make many of these available to you, peruse this Command and
Function Reference Manual. Whether you are using Info as an
interactive data base management tool or as a full programming
language, periodic rereading of this manual will enable you to get
more out of Info.
A Reference Manual is like a dictionary and a grammar; it is not
meant for the first time user. If you are new to data base management
languages, start with the tutorial manuals: Conversational
- i -
SR-Info/VP-Info and Programming SR-Info/VP-Info, also published by Sub
Rosa Publishing Inc.
Second, we would like to hear from you. Whether it is errors in
the program or the manual, or suggestions for improvements, write or
fax us, or direct comments to us through the conference on your major
public-access bulletin board.
Third, fill out the SR-Info/VP-Info SOFTWARE LICENSE AGREEMENT
AND REGISTRATION provided to you and mail it in. We are unable to
provide technical assistance and program updates to non-registered
users.
The language is available in three versions to meet the varying
needs of individuals, organizations and businesses:
A. SR-Info is an excellent choice for many individuals,
corresponding to the original release of VP-Info by
Paperback Software International, but with many added
features, more power and complete upward compatibility with
our more powerful versions.
SR-Info is widely available through users' groups and
public bulletin boards as a "shareware" product, giving you
the opportunity to "try before you buy." Users who decide
to upgrade from SR-Info to one of the other versions are
given full credit for registration fees paid toward their
purchase of VP-Info Professional or VP-Info Professional
Network Edition.
SR-Info may be freely copied and distributed to others
in the United States and Canada only in its complete,
unaltered, compressed form only, provided that no fee (other
than a nominal copying fee) is charged, that no printed
manual is supplied with the disk(s), and no representation
is made that the recipient has any right to use the software
without registration for more than evaluation and study
purposes.
Those making use of SR-Info in commercial and other
serious environments are expected to register their copies,
thus entitling them to their own bound manuals and the
opportunity to get telephone support and consultations.
B. VP-Info Professional is the enhanced, single-user version of
the language, offering access to many more files, more
records, more features and more power.
VP-Info Professional is not available as a "shareware"
product, and distribution of the software or manuals by
anyone except authorized VP-Info Professional Resellers is
- ii -
strictly prohibited. One registered copy is required for
each computer on which VP-Info Professional is run.
C. VP-Info Professional Network Edition is the full network and
multi-user version of the language, conforming to the file
sharing and locking conventions of Microsoft DOS, versions
3.1 and above.
Unlike most network applications software, VP-Info
Professional Network Edition comes with a license for all
users on each server. If a network includes multiple
network servers, one copy is required for each server.
If you have any difficulty in meeting your objectives with Info,
we invite you to call on us for assistance. All users registered with
Sub Rosa Publishing Inc. are entitled to obtain technical support and
advanced consulting by telephone. Consult your Registration
Certificate for hours, specific entitlements, and charges for
additional consultations.
Please remember that Info is not an application program; it's
actually a rich and powerful computer language that makes looking
after your data a lot easier that available alternatives. But putting
all this power into your hands does carry a price: mistakes can result
in loss of data or erroneous results. Sub Rosa Inc. and Sub Rosa
Publishing Inc. assumes no liability or responsibility for any damages
whatsoever (including, without limitation, damages for loss of
business profits, business interruption, loss of business information,
or other pecuniary loss) arising out of the use of or inability to use
this software. Additional information is contained in the limited
warrantee attached to the license agreement provided to you.
Users who are members of major public bulletin boards may find
their local BBS carries a conference dealing with Info. Sub Rosa
Publishing regularly downloads questions from a number of BBS systems
and uploads answers, comments and suggestions. Call our office for
assistance in locating an appropriate BBS.
In addition, the best of our bulletin-board and other
correspondence, plus articles and program examples are published on
our SR-Info/VP-Info Diskozine, our magazine-on-a-disk. Subscriptions
are available from our office.
We hope you will find Info useful and fun to use, and get years
of satisfaction from it.
Sidney L. Bursten and Bernard Melman
Sub Rosa Publishing Inc.
Unit 18-1170 Sheppard Ave. West.
Downsview, ON, Canada M3K 2A3
Phone: (416) 398-8414
- iii -
Fax: (416) 630-7384
- iv -
SR-Info/VP-Info Reference Manual Page v Table of Contents
TABLE OF CONTENTS
SECTION 1. USING Info
1.1. Setting up Info
1.2. Conversational Info
1.3. Running Programs with Info
1.4. Compiling with Info
1.5. The Configuration File
1.6. The SET File
SECTION 2. Info FILES AND VARIABLES
2.1. Files
2.2. Selecting Data Files
2.3. Variables
2.4. Variable Look-Up Rules
2.5. Matrix Variables
2.6. System Variables
Function keys
:DATE and :TIME
:PICTURE
Other system variables
SECTION 3. Info FUNCTIONS
3.1. Constants
3.2. Operations
3.3. Relations
3.4. Functions
3.5. Expressions
3.6. Rules of Precedence
SECTION 4. Info COMMANDS
4.1. The Form of the Commands
4.2. Symbols
4.3. Command List
SR-Info/VP-Info Reference Manual Page vi Table of Contents
APPENDIX A. THE Info COMPILER
A.1. What Happens at Compilation
A.2. Info Environment
A.3. Info Memory Use
64K data space
Data file headers
Other buffers
The memory variable header table
The memory variable storage table
Stacks
Program space
High memory
A.4. Modules and Environment
A.5. The Compilation Process
A.6. Compiling and Data Files
A.7. How Info Reads a Command Line
A.8. Compiling Multiple Subroutines
A.9. Data-File Headers
APPENDIX B. Info KEYWORDS
APPENDIX C. Info ERROR MESSAGES
Software Registration
By loading the Software on a computer and/or signing this
Software Registration Form, the User agrees to abide by the terms of
the Software License Agreement and Limited Warranty which follows.
Without agreeing to these terms, the User shall have no right to use
the Software, namely any one of SR-Info, VP-Info Professional, or
VP-Info Professional Network Edition; furthermore, without this
registration, the User shall have no right to receive technical and
consulting support, or to obtain any of the benefits conferred by the
Limited Warranty below, except that unregistered users may obtain
telephone advice necessary to load the Software properly on their
computers.
User's Name___________________________________________________________
Company (if any)______________________________________________________
Address_______________________________________________________________
_______________________________________________________________
City_________________________________________State____________________
Country________________________Zip/Postal Code________________________
Product_________________________Serial Number_________________________
Computer model________________________________________________________
Preferred Floppy Disk Format: 5.25 inch 360K [ ] 5.25 inch 1.2Mg [ ]
3.50 inch 720K [ ] 3.50 inch 1.4Mg [ ]
Authorized Signature__________________________________________________
Software License Agreement and Limited Warranty
I. User's Rights. By purchasing and registering one copy of the
Software, namely any one of SR-Info, VP-Info Professional, or
VP-Info Professional Network Edition, the user has acquired the
right to use the Software on a single computer (i.e. a single
screen attached to a single CPU), and to make copies of the
Software for archival purposes. You may not network the Software
or otherwise use it on more than one computer or computer
terminal at the same time, except that purchasers of VP-Info
Professional Network Edition may share one copy of that Software
across an entire network, provided that a separate, licensed copy
of the Software resides on each and every dedicated server on
that network.
II. Technical Assistance and Consulting. To assist registered users
in obtaining maximum benefits from the Software, Sub Rosa
Publishing Inc. provides technical assistance and consultation
services every weekday at its offices. Full registration for the
Software includes one hour of telephone consultation; additional
requirements are charged to the user at the then current fee
schedule. Users of SR-Info have the option of partial
registration, which does not include prepaid telephone support.
III. Copyright. The Software and documentation is owned by Sub Rosa
Inc. and Sub Rosa Publishing Inc. or its suppliers, and is
protected by copyright laws of the United States and Canada, and
other nations under international treaty provisions. Therefore,
you must treat the Software like any other copyrighted material
(such as books, recordings and movies) and make no copies of the
Software except, that:
1. You may make copies of the Software for archival or
backup purposes
2. You may transfer the Software to a hard disk, provided
that only one copy of the Software is used at any one
time (except for users of VP-Info Professional Network
Edition governed by the special provisions of
Paragraph I.
3. You may not copy the written manuals accompanying the
Software, nor print more than one copy for personal use
of any manual or documentation provided on the
distribution disk with the Software.
4. You may not rent or lease the Software, but you may
transfer the Software and its accompanying written
manuals on a permanent basis, provided you retain no
copies, and the recipient agrees to the terms of this
Agreement.
5. A special exemption to the restrictions in this
paragraph apply to SR-Info, which is distributed as a
"shareware" or "try before you buy" product: SR-Info
may be freely copied and distributed to others in the
United States and Canada only in its complete,
unaltered, compressed form only, provided that no fee
(other than a nominal copying fee) is charged, that no
printed manual is supplied with the disk(s), and no
representation is made that the recipient has any right
to use the Software without registration for more than
evaluation and study purposes.
IV. Limited Warranty. Sub Rosa Publishing Inc. warrants that the
Software will perform substantially in accordance with the
accompanying written manuals for a period of 90 days from the
date of receipt. Any implied warranties on the Software are
limited to 90 days. Some jurisdictions do not permit a limit on
the duration of an implied warranty, so this limitation may not
apply to you.
V. Your Remedies. The entire liability of Sub Rosa Inc. and Sub
Rosa Publishing Inc., and your exclusive remedy, shall be, at the
option of Sub Rosa Publishing Inc., either (a) the return of the
price paid for the Software, or (b) replacement of the Software.
This Limited Warranty is void if failure of the Software resulted
from accident, abuse, or misapplication. Any replacement
Software will be warranted for the remainder of the original
warranty period or 30 days, whichever is longer.
VI. No Other Warranties. Sub Rosa Publishing Inc. and Sub Rosa Inc.
disclaim all other warranties, either expressed or implied,
including but not limited to implied warranties of
merchantability and fitness for a particular purpose, with
respect to the Software and any accompanying written manuals.
VII. No Liability for Consequential Damages. In no event shall Sub
Rosa Publishing Inc. or Sub Rosa Inc. or their suppliers be
liable for any damages whatsoever (including, without limitation,
damages for loss of business profits, business interruption, loss
of business information, or other pecuniary loss) arising out of
the use of or inability to use the Software, even if Sub Rosa
Publishing Inc. or Sub Rosa Inc. has been advised of the
possibility of such damages.
Sub Rosa Publishing Inc.
Unit 18-1170 Sheppard Ave. West.
Downsview, ON, Canada M3K 2A3
Phone: (416) 398-8414
Fax: (416) 630-7384
SR-Info/VP-Info Reference Manual Page 1 SECTION 1
SECTION 1. USING SR-Info AND VP-Info
Before you can start running SR-Info/VP-Info (which, for the
balance of this manual, we'll call Info by itself), you should
familiarize yourself with some basic topics. These are discussed in
this section, beginning with "what is a data base anyway?" and
continuing with getting Info into operation, and using Info without
and with programs.
This sections also covers installation of Info on your computer,
and customizing the installation to meet your specific needs.
Finally, some considerations for advanced users are discussed,
and the several different versions of Info are compared.
SR-Info/VP-Info Reference Manual Page 2 SECTION 1
1.1. Basic Concepts and Orientation
There are some basic concepts and vocabulary that are fundamental
to getting maximum results from using Info.
These are discussed here, including records and fields, file
names and field names, your keyboard and the way we use and refer to
its various keys.
Records and Fields. Everybody keeps information on file cards.
Here is a 3x5 card kept on an employee in a small company:
βββββββββββββββββββββββββββββββββββββββββββββ¬ββββ
β Name: Marek, Joe β 1 β
β Address: 231 River Drive βββββ€
β Broomsdale, MD β
β 02110 β
β Telephone number: 566-7012 β
β Married: Y β
β Salary: 25,800.00 β
β Year employed: 1981 β
β Department: Maintenance β
βββββββββββββββββββββββββββββββββββββββββββββββββ
Now learn some computer jargon: the electronic version of a
filing box (containing such cards) is called a data file; a card
itself is called a record. The number in the upper-right corner of
the card identifies the card as card number 1. The same way, records
are numbered by record number.
A card has separate areas for the various pieces of information
you want to collect. We call these areas fields. Each field is
identified by its name. In this example, for instance, "Department"
is a field name, while "Maintenance" is the contents of the field.
You identify records by their number, fields by their names. How
do you identify data files? By their names, of course. For instance,
all the cards of your employees could be sitting in a box labelled
"Employee Records." Unfortunately, the name you can give to a data
file in your computer is rather restrictive: only 8 letters or numbers
can be used. So EMPLOYEE will have to do; EMP1, EMP2 are also good
Basic Concepts and Orientation Basic Concepts and Orientation
SR-Info/VP-Info Reference Manual Page 3 SECTION 1
file names. (Do not use COMP for the first four letters of a data or
index file name; Info is unable to open such a file.)
A file is actually identified by its drive designation, its
directory, its file name, and its extension. For example, the full
designation of our employee file could be C:\DATA\EMPLOYEE.DBF.
File names. A file name can have at most 8 characters. You can
use all the letters of the alphabet, the digits 0 to 9, and the
underscore character (_). You can use both capital and lower-case
letters, but the lower-case letters will be replaced by their
upper-case version.
The restrictions on a file name are imposed by the operating
system of your computer. (Check your Operating System Manual. In
this book it is assumed that you have a little familiarity with your
computer and operating system. Specifically, you should know the
drive designations, the operating system prompt, the DIR command, and
how to handle floppy disks.) It may allow you to use some other
characters as well. However, you cannot go wrong following the rules
as they were stated above.
Note that the blank (the character you get by pressing the
spacebar), some punctuation symbols (. , :) , and most special
characters (< > | + and so on) are always prohibited. For instance,
you are never allowed to use as a file name two short words separated
by a blank, such as CAR NAME.
The data file we mentioned before, EMPLOYEE, also has an
extension, "DBF". When you type in the full name, the extension is
separated from the file name by a period, though when you see it
listed by DIR, the extension will be separated from the name by one or
more spaces. The extension may have at most three characters; all
Info file extensions have exactly three letters.
The extension DBF stands for Data Base File. There are many
other file types used by Info. The extension always reveals the type
of the Info file. Most of the commands do not require the extension.
For instance, when you create a data file, Info adds the extension DBF
unless you provide another one specifically.
When you use a data file, just give the file name (with or
without the drive designation), and Info adds the DBF extension to
look the file up. As a rule, when Info asks for a file name, do not
bother to give the extension.
Field names. A field name has at most 10 characters (two more
than file names); you can use all the letters, the digits 0 to 9, the
colon (:), and the underline (_). The first character must be a
letter. Again, you can use lower-case letters, but Info will convert
them to upper case. Just as for file names, blanks cannot be used.
Basic Concepts and Orientation Basic Concepts and Orientation
SR-Info/VP-Info Reference Manual Page 4 SECTION 1
You have just read the formal rules for file and field names.
The most important rule, however, is the following:
Always use file names and field names that are easy to
remember, names that remind you of what is in the data file and
field.
So FILE1, as a rule, is a bad name, EMPLOYEE is good. NAME1ST is
good for first name (and so is FNAME), FIELD2 is bad.
How do you test whether a file or a field name is good by this
rule? If you do not have to look up the file and field names when you
use them, they were named well. If you have to look the names up all
the time, use better names.
Field Types. In setting up the data file (our electronic 3x5
cards), we first chose a name for it: EMPLOYEE. Next we choose the
field names.
For the name (Marek, Joe), NAME is fine, but hard to handle.
Later, we may need reports in which the first name and the family name
are displayed differently. So we split up the name into two fields:
NAME for the family name and FNAME for the first name.
The address is in three lines. Since you cannot put three lines
in a field (and also to gain flexibility in reporting), we split the
address up into four fields: ADDR, CITY, STATE, and ZIP.
Telephone number becomes TEL:NO; married can stay MARRIED; Salary
can stay SALARY; Department is too long, so use DEPT instead.
Finally, we shorten Year employed to YEAR:EMP. (Note that ":" or "_"
is used in place of the blank, which is not allowed.)
The fields NAME, FNAME, ADDR, CITY, STATE, ZIP, TEL:NO, DEPT will
be filled with text; anything that can be typed can go into these
fields. You tell this to Info by saying that the field type is
character, or the field is a character field. The abbreviation for
character type is C.
It is not enough to say that NAME is a character field; Info also
wants to know how many characters you want to allow in the field.
This number is called the width of the field. For instance, if we
specify 15, that means that any text of up to 15 characters can be
typed into NAME. We can always type less. (Info will fill what is
left of the field with blanks.)
It is not always easy to decide the width of a field. What is
the longest family name we'll have to use? Don't worry, we can make
changes later.
Basic Concepts and Orientation Basic Concepts and Orientation
SR-Info/VP-Info Reference Manual Page 5 SECTION 1
In this example, we use the CREATE command (see Section 4.3):
1>CREATE employee
and enter the following:
Field: Type: Width:
NAME C 15
FNAME C 10
ADDR C 20
CITY C 20
STATE C 2
ZIP C 5
TEL:NO C 8
DEPT C 15
SALARY and YEAR:EMP are numbers. Of course, we could define them
as character fields, but then we could not do mathematical operations
on them. Since they are, by their nature, numbers, it is more natural
to define them as such, so we define them as numeric fields, type N.
The width of YEAR:EMP is 4; you also have to tell Info how many
digits are allowed after the decimal point; in this case there is no
decimal point, so we say 0.
The width of SALARY should be 9 to take salaries over
$100,000.00. When counting for the width, we count all the digits and
the decimal point. You are not allowed to type in 120000.00 as
120,000.00, so we do not make room for the comma; the width of SALARY
is 9, with 2 decimals.
Field: Type: Width: Decimals:
YEAR:EMP N 4 0
SALARY N 9 2
Finally, there is the field MARRIED. You could define it as a
character field of width 1. If you do this, Info will accept any
character for MARRIED. You can restrict the characters accepted to
"Y" (yes) "N" (no) by declaring MARRIED a logical field (L). In fact,
you can use any of "Y", "y", "T", or "t" for true, and any of "N",
"n", "F", or "f" for false.
A logical field is always of width 1.
Basic Concepts and Orientation Basic Concepts and Orientation
SR-Info/VP-Info Reference Manual Page 6 SECTION 1
Field: Type: Width: Decimals:
MARRIED L 1
The Keyboard. The next step is to create the EMPLOYEE file. But
before you do that, familiarize yourself with your keyboard (yours may
have more keys than this representation of the original standard IBM
PC keyboard, but all these keys are on your keyboard, and these are
the only ones you need for Info):
ββββ¬βββ ββββ¬βββ¬βββ¬βββ¬βββ¬βββ¬βββ¬βββ¬βββ¬βββ¬βββ¬βββ¬βββ¬βββββ₯ββββββββ¬ββββββββ
βF1βF2β βEsβ1 β2 β3 β4 β5 β6 β7 β8 β9 β0 β- β= β <- βNumLockβ Break β
ββββΌβββ€ ββββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄ββ¬βββ«ββββ¬ββββΌββββ¬ββββ€
βF3βF4β βTabβq βw βe βr βt βy βu βi βo βp β[ β] β` βHomβUp βPgUβ - β
ββββΌβββ€ βββββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬βββ΄βββ«ββββΌββββΌββββΌββββ€
βF5βF6β βCtrlβa βs βd βf βg βh βj βk βl β; β' β <ββ β<--β β-->β β
ββββΌβββ€ ββββ¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄β¬ββ΄βββ¬βββ«ββββΌββββΌββββ€ β
βF7βF8β β\ βShβz βx βc βv βb βn βm β, β. β/ βShftβ* βEndβ DnβPgDβ + β
ββββΌβββ€ ββββ΄β¬ββ΄βββ΄βββ΄βββ΄βββ΄βββ΄βββ΄βββ΄βββ΄βββ΄β¬ββ΄βββββΌβββ¨ββββΌββββ΄ββββ€ β
βF9βF0β βAltβ Space Bar βCpsLckβ Ins β Del β β
ββββ΄βββ βββββ΄ββββββββββββββββββββββββββββββ΄βββββββ΄βββββββ΄ββββββββ΄ββββ
Function Typewriter Keyboard Cursor Keypad &
Keys Numeric Keypad
There are a few special keys you have to know. <ENTER> refers to
the key usually called ENTER or RETURN, marked on some computers with
a hooked backarrow: <ββ. Some keyboards have both a RETURN and an
ENTER key; they are interchangeable.
At the right is a set of keys called the numeric keypad and/or
the cursor keypad. With the <Num Lock> key switched on or with the
<Shift> key depressed, these keys output numbers; otherwise they
control the cursor (the flashing rectangle that indicates where the
next character we press will appear on the screen) and other actions.
The key <End> is used to indicate the end of a Info procedure,
such as APPEND, BROWSE, CREATE, EDIT, WRITE.
The four arrow keys are referred to as <Up>, <Dn>, <Left>, and
<Right>. They are used to move the cursor around the
screen. The keys <Home>, <PgUp>, and <PgDn> are used for
some commands, such as EDIT, BROWSE, READ, and WRITE.
The left arrow on your cursor pad, <Left>, should not be confused
with the fat back arrow, <-, at the top of the keyboard,
called <Backspace>. <Left> moves left without affecting the
characters under it, <Backspace> "swallows up" each
character it moves over.
Basic Concepts and Orientation Basic Concepts and Orientation
SR-Info/VP-Info Reference Manual Page 7 SECTION 1
The delete key <Del>, and the insert key <Ins>, are used to
delete and insert characters on the command line and during
data entry and editing. Each time <Del> is pressed, one
character is removed at the cursor, and anything to the
right moves over to take its place. The <Ins> key is a
"toggle," meaning that if insert mode is on, pressing <Ins>
turns it off, and vice versa.
Your keyboard also has ten or more function keys at the left or
along the top; the ten marked <F1> to <F10> have pre-assigned roles
which can be changed by the user.
The escape key, <Esc>, can be used to escape from a command.
Sometime two keys have to be pressed at the same time. Ctrl-W
means press the control key (marked as Ctrl) and the W key at the same
time (there is no harm done pressing the control key first). Alt-F10
means press the <Alt> key and <F10> at the same time.
1.2. Setting up Info
To run Info, you need an IBM PC, XT, AT, or compatible MS-DOS
computer with two disk drives, at least 512K memory, and DOS 2.0 or
later.
To use Info, you need the following files, all having a
three-or-four-character name indication which version it is for, and
an extension descriptive of its contents.
A. All required or optional files for SR-Info have the name SRI
B. All those for VP-Info Professional have the name VPI
C. All those for all those for VP-Info Professional Network
Edition have the name VPIN
The extensions for these files are as follows:
A. The EXE file and the MSG file. Each version of Info has its
own set of matching executable and message files, both of
Setting up Info Setting up Info
SR-Info/VP-Info Reference Manual Page 8 SECTION 1
which must be in the same place, either in the current
directory or in any directory on the DOS PATH (see your DOS
manual for details on PATH). Info cannot be run without
both of these files.
In addition, both files are internally matched, so that
an EXE of one version or date of issue cannot be run without
the MSG file generated for that version on the same day.
To avoid errors, there should not be more than one copy
of each of these files anywhere in your hard disk.
The EXE file may be renamed if you desire, but the MSG
and all the following files must retain both their name and
extension.
B. The HLP file. Info has an excellent on-line help system
that can be run at any time you are in conversational
(interactive) mode. It is optional; to run it, the HLP file
must be in the same directory as the MSG file. If it is not
present, the HELP command does not work.
C. The CNF file. An optional configuration file generated by
the user. This is a regular Info program file (uncompiled),
residing in the subdirectory where Info is executed.
It is typically used to invoke the SET flags to suit
your needs, to define the function keys and such system
variables as :COMPANY and :TITLE (see Section 2.6), and to
establish where Info can expect to find files outside the
current directors (see FILES ... ENDFILES structure in
Section 4.3).
D. The SET file. (VP-Info Professional and VP-Info
Professional Network Edition only.) An optional file that,
if used, must reside in the directory where VP-Info is
executed. The SET file is discussed in detail in Section
1.6.
E. The SGN file. (VP-Info Professional and VP-Info
Professional Network Edition only.) An optional file
supplied with the system, providing an attractive sign-on
for the user each time VP-Info is executed.
The SGN file normally goes in the same directory as the
MSG file, but if you want it to be executed only in some
directories and not in others, you will have to put it in
each directory from which you want it executed, and make
sure it is not in any directory listed in the DOS PATH.
Setting up Info Setting up Info
SR-Info/VP-Info Reference Manual Page 9 SECTION 1
In addition, you must have a CONFIG.SYS file (in the root
directory of your boot disk, see the DOS Reference Manual) containing
the lines:
FILES=20
BUFFERS=20
If you are running VP-Info Professional under DOS 3.3 or above, you
may open as many as 65 files at the same time, provided the FILES=
command in both your CONFIG.SYS and the SET file is set that high.
1.3. Conversational Info
After you start Info, you see the copyright notice, and the Info
prompt:
1>
This prompt is Info's way of asking: What now? You can issue any
commands (as listed in Section 4.3) or you can write and run a Info
program.
Conversational SR-Info/VP-Info (also called interactive mode) is
the use of Info by directly entering commands instead of using
programs.
Info has a number of features to help you along. There are a few
hints to help you get into Info quickly.
Type in a command line; pressing <ENTER> executes the command:
1>DIR
The command line can be fully edited. Use the cursor keys
described in the keyboard section above, or the full list of editing
keys listed under the WRITE command in Section 4.3.
If there is an error in the command, the command line is
redisplayed; the cursor is placed on the first word after the word
that is the likely cause of the trouble. Use the editing keys to
change the command line; then press <ENTER> to try executing it again.
There are 78 characters on the command line available for a
command. If you type in a longer command line, these 78 characters
will act as a window, with some characters disappearing off the left
or right edge of the screen. You always see 78 characters of the long
command line.
Conversational VP-Info Conversational VP-Info
SR-Info/VP-Info Reference Manual Page 10 SECTION 1
Info stores away the last five command lines (up to 75 characters
each). You can get the previous command line back by pressing <Up> or
Ctrl-E. If you press the key twice, you get back the second last
command line, and so on. You can execute the recalled command by
pressing <ENTER>; you can edit the command before executing it just as
though you had typed it yourself.
Pressing a function key is the same as typing in a command line
or lines stored in a matching system variable. For example, :F1
usually contains the string "HELP ", so pressing the <F1> key is
exactly the same as typing in "HELP " (see Section 2.6).
Two special characters are used in defining the function keys:
semicolon (;) causes Info to issues an <ENTER> code and execute
everything already put into the command line, and the caret (^) stands
for "hold down the control key while pressing the next character in
the string". Examples:
<F2> usually contains "LIST STRU;", which means: enter the
string LIST STRU into the command line and
execute. This command lists the structure of the
selected data file
<F10> usually contains "EDIT;", which means: enter the
string EDIT into the command line and execute.
This command begins to edit the selected data file
To redefine the function key <F7> to contain a string causing
Info to go to the nearest record after an unsuccessful FIND and
immediately start to edit that record:
1>:F7='GOTO :near;edit;'
(see Section 2.3 and the = and FIND commands in Section 4.3). You may
also redefine a function key on the fly: if the command is already
typed in, just place your cursor at the end of the command line and
press Alt-F7 to capture everything to the left of the cursor into :F7.
Short programs (with no loops) can be stored in the function
keys, and executed by pressing the function keys.
The most important commands for a beginner becoming familiar with
Info are (see the alphabetical command reference in Section 4.3):
CREATE - create a new data file
MODIFY - change the structure on an existing data file
APPEND - add records to a data file
EDIT - view and change fields in a data file
BROWSE - view and change some fields in many records of a data
file
Conversational VP-Info Conversational VP-Info
SR-Info/VP-Info Reference Manual Page 11 SECTION 1
LOCATE FOR - goto a record that meets some condition
CONTINUE - goto the next record that meets the same condition
LIST - list the fields of all or some records in a data file
DISPLAY - list the fields in the current record of a data file
COUNT - count the records in a data file
SUM - add up the values of a numeric field in a data file
SORT - sort a data file into a new file with a new order
INDEX - create a separate file that maintains the apparent
order of a data file without sorting the file
FIND - find a record in an indexed file by the value of its
"key"
REPORT - produce a formatted list of a data file with optional
headings, subtotals, and totals
STATUS - check what files are open, the setting of SET
commands, and the value of memory variables
LIST STRUCTURE - check the structure of the current data file
WRITE - create or edit a text file or program
The forthcoming Sub Rosa Publishing Inc. manual Conversational
SR-Info/VP-Info explains use of these commands and many of the
interactive features in greater detail.
1.4. Running Programs with Info
When you see the operating system prompt (A> or C> for example),
you can run the Info program MENU by typing
C>VPI menu
(or SRI menu, or VPIN menu as the case may be). Info will load itself
into memory, execute the CNF file if found, and then run MENU.
From within Info, that is, when you see the Info 1> prompt (or
2>,...,10>), run a program with the DO command:
1>DO menu
In either case, Info will first look for a compiled program:
MENU.CPL; if it is found, Info will run it. If there is no MENU.CPL,
Info will look for an uncompiled program, MENU.PRG, which it will
compile on-the-fly and immediately execute. The program name may not
have an extension in the command line.
There are two other types of program which can be run by Info:
standard EXE, COM, and BAT programs with the RUN command, and (in
VP-Info only) binary file (assembly language) programs with the CALL
command. See RUN and CALL in the command reference section.
Running Programs Running Programs
SR-Info/VP-Info Reference Manual Page 12 SECTION 1
1.5. Compiling with Info
There are two ways to compile a program. The first is on the
command line itself:
1>COMPILE menu
Alternately, you can compile many programs in one step by
creating and running a program containing a set of COMPILE commands.
For example, PROJ.PRG may consist of the following commands:
COMPILE prog1
COMPILE prog2
COMPILE prog3
CHAIN proj1
Then
1>DO proj
will compile PROG1, PROG2, and PROG3, and immediately execute PROJ1.
(The command DO issued at the command line is equivalent to CHAIN;
inside a program, its meaning is different.)
1.6. The Configuration and Setting Files
When Info is invoked, it first looks for some special files that
are used to customize its installation to meet the user's special
needs.
The SET file. VP-Info Professional and VP-Info Professional
Network Edition allow a settings file with the extension SET, used by
Info primarily to allocate memory during loading. The five commands
supported by the SET file permit the user to:
1. Set the maximum amount of memory to be used by VP-Info
(see MEMORY= command in Section 4.3)
2. Set the maximum amount of memory to be allocated for
loading binary files (assembly-language routines) that
can be executed from within VP-Info (see BINSPACE=
command in Section 4.3)
Configuration File Configuration File
SR-Info/VP-Info Reference Manual Page 13 SECTION 1
3. Set the maximum number of files that can be opened at
one time by VP-Info (see the FILES= command in
Section 4.3)
4. Set the maximum number of fields there can be in all
data files opened at any one time (see FIELDS= command
in Section 4.3)
5. Suppress special screen and sound effects accessed
through the SCREEN, SOUND and RING commands (see
NOEFFECTS command in Section 4.3)
The SET file is completely optional, but users of certain
computers not 100% compatible with the IBM AT, or using certain
operating systems, may find it necessary to suppress the special
effects with the NOEFFECTS command. See NOEFFECTS in the command
reference section of this manual for more details.
SR-Info does not support binary programs or the special screen
and sound effects, and uses default settings for all the other
commands used in the SET files of VP-Info Professional and VP-Info
Professional Network Edition. No SET file is used with SR-Info.
The CNF file. SR-Info and all versions of VP-Info allow a
configuration file with the extension CNF. The CNF file is a regular
Info program file (uncompiled), residing in the subdirectory where
Info is executed.
The CNF file is completely optional, but it is extremely useful
to define the SET flags to suit your needs, to define the function
keys and such system variables as :COMPANY and :TITLE (see Section
2.6), and to establish where Info can expect to find files outside the
current directors (see FILES ... ENDFILES structure in Section 4.3).
Any command can be used in the CNF file, but since it is compiled
anew every time you enter Info, it should be kept as short as
possible.
If the last line of the file is a CHAIN command, the program
chained to will be executed immediately, even if the DOS command that
started Info names another program (see Section 1.4).
Configuration File Configuration File
SR-Info/VP-Info Reference Manual Page 14 SECTION 1
1.7. Some Considerations For Advanced Users
How to have different versions of Info coexist with one another.
There are actually several different situations, all of which have to
be discussed separately:
A. Running two or more of the following -- SR-Info, VP-Info
Professional, and VP-Info Professional Network Edition --
on the same computer:
1. If no two versions access the same data or programs,
there is no problem. Just load all of the appropriate
files into the proper directories as shown in
Section 1.2.
2. If no network is involved, and the same programs are to
be executed two or more different versions of the
above, it is only necessary to provide a different
directory for each version's CPL files, and use the
FILES ... ENDFILES structure in each version's CNF file
to direct Info to the correct set of compiled programs.
If programs for the different versions are not
limited to the commands and functions available to the
lowest-power version, separate directories for the
programs may also be necessary.
3. There is no safe way to allow single-user versions to
operate in a network environment; do not try it except
in a completely private directory, and do not access
any files of any type which may also be accessed by
VP-Info Professional Network Edition.
B. Running VP-Info Version 1 together with one or more of the
following -- SR-Info, VP-Info Professional, and VP-Info
Professional Network Edition -- on the same computer:
1. The only files compatible between Version 1 and the
current versions are text files and libraries, report
form files, and data files. All other files must be
segregated into separate directories for each version
if they are to be shared by the two versions.
2. Running Version 1 and VP-Info Professional is more
difficult than other combinations, since the main file
name is the same in both cases, VPI.EXE, and both look
For Advanced Users For Advanced Users
SR-Info/VP-Info Reference Manual Page 15 SECTION 1
for VPI.CNF. Therefore, these two versions must be
started in separate directories, and access to the
shared files coordinated through the FILES ... ENDFILES
structures in their respective CNF files.
C. Networking under Version 1 and VP-Info Professional Network
Edition is incompatible and can cause catastrophic failure
and data corruption if an attempt is made to share data
files between them.
Differences between the various versions of the language. There
are five versions to consider; in increasing level of power they are:
A. VP-Info Version 1. Main technical specifications:
Maximum 65,536 records in a data file
Maximum 6 open data files
Maximum 20 files open at one time, including DOS files
Index structure incompatible with other four versions
Included network facilities
Temporary files (those with extension starting with $)
cannot be redirected with FILES ... ENDFILES structure
to ramdisk or disk with more space
Expression lists could be separated either by commas or
spaces in many commands; now only commas are allowed
Following functions substantially modified or not carried
forward to newer versions:
CONVERT( split into two new functions, CTONUM(
and NUMTOC(
DBF( split into DBF( and FLD(
DIR( split into DIR( and DIRX(
Following commands substantially modified or not carried
forward to new versions:
:TERMINAL= terminals no longer supported
SET ANSI no longer supported
SET COLON now use SET DELIMITER
SET FIELDS now use FIELD= in SET file
SET MEMORY now use MEMORY= in SET file
B. SR-Info:
Same number of files and records as Version 1
Creates index files compatible with products C, D and E
No network facilities
EDIT allows appending records, and APPEND allows editing
existing records
EDIT and BROWSE allow editing with a user-designed screen,
even from command line
INDEX FROM allows a new index file, with same or different
name, to be created using expression of existing Info,
dBASE or Clipper index file
For Advanced Users For Advanced Users
SR-Info/VP-Info Reference Manual Page 16 SECTION 1
New scanning commands: MAXIMUM, MINIMUM
Other new commands include:
LIMIT
SET CARRY
SET DIR
SET HEADING
new functions implemented include:
ASC(
AT(
DELETED(
EOF(
IFF(
MAX(
MENU(
MIN(
NUMTOC(
SUBSTR(
UPPER(
Some advanced functions, commands and options present in C,
D and E are not implemented in this version
C. VP-Info Version 2. All features of SR-Info plus:
Unlimited number of records
Maximum index size 32Mb; large enough for over 1,000,000
records with 15-character key
Up to 10 data files open at one time
EDIT and BROWSE allow editing with both a user-designed
screen and an ON FIELDS structure in programs
SET file gives user control over how Info is loaded into
memory, including:
Up to 65 files open at one time
Up to 1000 fields in all data files open at one time
Special screen and sound effects implemented
Loading and running binary programs
New commands implemented include:
New FIND variants: NEAREST, LAST, SEEK
MAXIMUM
MINIMUM
SET DIVZERO
New functions implemented include:
CTONUM(
DBFX(
DIRX(
NDX(
RAND(
RECNO(
D. VP-Info Professional
For Advanced Users For Advanced Users
SR-Info/VP-Info Reference Manual Page 16.1 SECTION 1
Allow even larger index files
New command:
OVERWRITE to
New function:
IFKEY(
E. VP-Info Professional Network Edition
Full support for DOS 3.1 and above network facilities,
including data and index files opened in LOCK, WRITE,
SHARE, and READ modes
FILES and FILES ... ENDFILES structure enhanced to support
file modes and well as file redirection
Commands implemented include:
LOCK
LOCK INDEXES
SET LOCK
SET NETWORK
UNLOCK
UNLOCK INDEXES
SECTION 2. SR-Info/VP-Info FILES AND VARIABLES
In Conversational SR-Info/VP-Info (interactive) and in
SR-Info/VP-Info programming, you deal with various file and variable
types. These are discussed in this section.
2.1. Files
SR-Info/VP-Info uses different types of files; the type of the
file is shown by the extension of the file name (this is the default
extension; the commands allow the user to change the extensions with
two exceptions: PRG and CPL).
Data files (also called the database files) contain the data of
the database. The default extension is DBF. Data files are created
with the COPY, CREATE, and COPY STRUCTURE TO commands. (See also
MODIFY.)
A data file contains a header describing the structure of the
data file: the number of records, the number of fields in a record,
and a description of each field (name, type, width, and for numerical
Files VPI VPIN Files
SR-Info/VP-Info Reference Manual Page 17 SECTION 2
fields, the number of decimals). The header is followed by the
records.
There are three types of data files used by SR-Info/VP-Info: Type
1, Type 2, and Type 3. From the user's point of view, it very seldom
matters which type is used, and the type is "transparent."
Type 1 data files can have up to 256 fields per record. The size
of the header is commensurate with the number of fields. To create
and use such data files, the SET FIELDS TO command has to be used.
Type 2 data files are restricted to 32 fields per record. The
size of the header is fixed, it does not depend on the number of
fields actually used. Type 2 data files are identical with dBASE II
data files.
Type 3 data files can have up to 300 fields per record. The size
of the header is commensurate with the number of fields (but much
larger than the header of a Type 1 data file with the same number of
fields. Type 3 data files are identical with dBASE III and IV data
files without memo fields, although VP-Info permits more fields in a
file than dBASE.
The command CREATE can create data files of Types I and 2,
although the default is Type 3. The type can be changed in MODIFY,
but the default is to leave type unchanged. All commands can use data
files of all three types.
Index files are used to facilitate rapid access to the data in
data files in a predetermined order for processing and reporting. The
default extension is NDX. Index files are created with the INDEX
command.
Program files contain the programs. There are two kinds: the
source program (a text file with SR-Info/VP-Info commands as text)
with extension PRG and compiled program with extension CPL. These
extensions are compulsory! (There is one exception, the CNF
configuration file; see Section 1.5.)
Report form files contain the specifications of a report. The
default extension is FRM. These files are used by the REPORT command.
Memory variable files contain the memory variables saved by the
SAVE TO command. The default extension is MEM.
Sequential files (also called text files) contain "lines"; the
end of line is marked by carriage return (ASCII code 13) and line feed
(ASCII code 10). A line can contain at most 254 characters. The end
of the file is marked by EOF (26).
A set of functions -- ROPEN(, WOPEN(, READ(, WRITE(, IN(, OUT(,
SSEEK(, and CLOSE( -- is provided to create, read, and write
Files VPI VPIN Files
SR-Info/VP-Info Reference Manual Page 18 SECTION 2
sequential files in SR-Info/VP-Info programs Most word processors
create (or have an option to create) sequential files. Such files can
then be utilized by SR-Info/VP-Info programs.
The WRITE command of SR-Info/VP-Info creates and edits sequential
files. Since it is used primarily to work with program files, the
default extension is PRG.
There are text files with default extension TXT used by the SET
ALTERNATE TO <file> command.
Finally, SR-Info/VP-Info can manipulate arbitrary DOS files with
another set of functions -- ROPEN(, WOPEN(, GET(, PUT(, SEEK(, and
CLOSE(. A typical application of the use of DOS files is the
conversion of a data file from one type to another.
File names are requested by <file> in the command descriptions.
<file> is the file name, usually, without extension. If no extension
is given, then the default extension is added by SR-Info/VP-Info.
However, if the user types in an extension, this overrules the
SR-Info/VP-Info default extension (exceptions: PRG, CPL, and CNF are
compulsory).
The file name has to follow the rules set out by the operating
system: there are at most 8 characters in a file name. You cannot go
wrong if the first character is a letter and the other characters are
letters and numbers; spaces are never permitted.
DOS devices include such names as PRN, CON, AUX, LPT1, COM2, etc.
Any sequential or arbitrary file function, and most of the copy and
spool commands, allow you to specify either an actual file or a
device.
Technically, input/output involving files is buffered, while
input/output involving devices is not. In SR-Info/VP-Info you may
choose to treat any device as either buffered or unbuffered, merely by
adding a colon to the end of the name to have DOS treat it as an
unbuffered device, and without a colon to designate a buffered file.
In most cases it makes little difference how you treat a device;
rules for when one technique is better than another is outside the
scope of this manual.
See your DOS manual for a complete list of DOS device names.
Files VPI VPIN Files
SR-Info/VP-Info Reference Manual Page 19 SECTION 2
2.2. Selecting Data Files
SR-Info can use up to 6 data files at the same time, while both
VP-Info Professional and VP-Info Professional Network Edition can use
up to 10 at a time. Each data file used is assigned a file number by
which the data file can be referenced. File number may be assigned in
an arbitrary manner, subject to the cautions contained in Appendix A.
Before activating a file, select a file number with the SELECT
command. To activate the first file as the data file CUST, and third
file as the data file TRANS:
1>SELECT 1
1>USE cust
1>SELECT 3
3>USE trans
Note how the SR-Info/VP-Info prompt shows the file number selected.
There are three ways to indicate which file in use is referenced:
a. Choose the file number. The choice remains in effect until
otherwise specified. This is done with the SELECT command.
1>SELECT 2
selects file 2. All commands refer to it, all field names are checked
in it.
b. Choose a file number for one command only. This is done by
following the first word of the command by # and the file number. For
instance,
1>LIST#2
lists file 2, regardless of which one is presently selected. (Note:
there is no space before or after the # sign.) Even if the command
requires two or more words (e.g., COPY STRUCTURE TO), the first-word
rule applies: COPY#2 STRUCTURE TO temp.
This technique, called command redirection, can even be used to
open the data files themselves, as follows:
1>USE#1 cust
1>USE#2 inven
1>USE#3 trans
Selecting Data Files VPI VPIN Selecting Data Files
SR-Info/VP-Info Reference Manual Page 20 SECTION 2
c. Refer to one field in a file. This is done by field
redirection, following the field with # and the file number. For
instance,
DAVID#4
refers to the field DAVID in file 4.
In this manual, "the selected file" refers to the data file
currently selected. In the last series of commands, at the start,
CUST is the selected file. After the command:
1>SELECT 3
TRANS is the selected file. Note that a SELECT command only selects a
new file number; there may be no file used under that file number.
2.3. Variables
A SR-Info/VP-Info variable is a storage area in which changing
values can be stored. If the storage is in a data file, the variable
is called a field; if the storage is temporary, in the memory only,
the variable is called a memory variable.
SR-Info/VP-Info also has a special type of variable called a
system variable, including the contents of the ten function keys, date
and time, default report title, and so on. System variables are
discussed in Section 2.6. The name of a system variable starts with a
colon.
There can be only 128 active memory variables. Since any one of
these can be a matrix variable (see Section 2.5), only the available
memory limits the number of memory variables.
A variable is identified by its name. A name is 1 to 10
characters long; the first character must be a letter; the other
characters are letters (converted to upper case), digits, :, and _
(underline).
Here are some examples of valid variable names:
cost
cost2
m:cost
first_name
But note:
Variables VPI VPIN Variables
SR-Info/VP-Info Reference Manual Page 21 SECTION 2
prof 2 invalid; space is not allowed in a name
2cost invalid; the first character must not be 2
profitcenter invalid; more than 10 characters
If the variable name is too long, only the first 10 characters
are used (so PROFITCENTER1 and PROFITCENTER2 are the same for
SR-Info/VP-Info, and will be stored as PROFITCENT).
SR-Info/VP-Info uses a number of words in its vocabulary, the so
called SR-Info/VP-Info keywords (see Appendix B). It is suggested
that keywords not be used as variable names. In fact, the first four
letters of a variable name should be different from the first four
letters of a SR-Info/VP-Info keyword, since SR-Info/VP-Info identifies
a keyword by its first four letters. See, however, Section A.
A variable has a type: character, numeric, or logical.
A. A variable of character type is also called a string
variable. A string variable contains a string (a text
line); it has a width, the number of characters it contains.
B. A numeric variable contains a number; it has a width (the
number of digits and, optionally, a decimal point), and the
number of decimals.
C. A logical variable contains a logical value: T (true, also
t, Y, y) or F (false, also f, N, n).
For a field, the type and the width (and for numeric fields, the
decimals) are fixed by the structure of the data file. For a memory
variable, all these may change any time a new value is stored to the
variable.
Fields are defined with the CREATE command, when the data file is
set up, or with the MODIFY STRUCTURE command when the structure of the
data file is modified. The value of fields may be changed by a number
of commands: REPLACE, EDIT, BROWSE, @ GET, and so on.
Fields can also be referenced with the file name: MENU[2] is the
second field of the data file MENU; TEST[210] is field 210 of the data
file TEST. Thus fields can be referenced as elements of a matrix.
Memory variables are defined (and redefined) with the commands:
=, STORE, ACCEPT, AVERAGE, COUNT, INPUT, READ(), SUM, WAIT. WRAP()
redefines the value of a memory variable. @ GET redefines the value
of a memory variable but does not change its characteristics.
Matrix variables are handled somewhat differently; see
Section 2.5.
Variables VPI VPIN Variables
SR-Info/VP-Info Reference Manual Page 22 SECTION 2
A memory variable can be declared GLOBAL. This means that when a
program is chained to another, GLOBAL variables are passed to the new
program. See the commands GLOBAL and CHAIN in Section 4.3.
2.4. Variable Look-Up Rules
When SR-Info/VP-Info finds an expression in a command, it has to
work out its value. It follows a strict order as follows to determine
what the item is:
1. Is it a function?
2. Is it a numeric constant?
3. Is it a string constant?
4. Is it a system variable?
5. Is it a matrix variable?
6. Is it a redirected field (e.g. name#3)?
7. Is it a field in the selected data file?
8. Is it a memory variable?
9. Is it a logical constant?
If still not found, SR-Info/VP-Info gives up and issues a Variable not
found" error message.
Note that a variable should not have the same name as a field,
and neither variables nor fields should have the same name as one of
the logical constants Y, N, T, or F. The potential for puzzling
behavior is obvious.
2.5. Matrix Variables
A memory variable can be defined as a matrix with the DIM
command. A matrix variable is counted as only one memory variable
within the 128 limit on the number of memory variables.
Any one matrix variable can occupy up to 64K memory in high
memory. The available high memory is shown by the STATUS command.
See the command DIM on how to compute the memory requirement, and
Appendix 1 (Section A.1) on how SR-Info/VP-Info uses memory.
Here is an example on how to define a matrix:
1>DIM NUM a[2,5]
1>a[1,1]=34.78
1>a[1,2]=45.7
1>a[2,2]=1234.71
Matrix Variables VPI VPIN Matrix Variables
SR-Info/VP-Info Reference Manual Page 23 SECTION 2
1>a[1,1]=34.78
1>a[1,2]=45.7
1>a[2,2]=1234.71
1>a[2,4]=1000
1>? a
34.78 45.70 0.00 0.00 0.00
0.00 1234.71 0.00 1000.00 0.00
The SET WIDTH TO command can be used to influence how many items
from the matrix are displayed in a line.
Matrix variables can be assigned values only with the = and STORE
commands. Instead of
ok=READ(a[5])
write
ok=READ(temp)
a[5]=temp
There is no limitation on the use of matrix variables in
expressions. A matrix variable may occur at any place where a
function may occur. You may think of a matrix variable as a special
type of function that can store values.
The REPEAT loop is convenient to manipulate matrix variables.
2.6. System Variables
System variables carry information necessary for the running of
SR-Info/VP-Info. The command LIST SYSTEM lists the system variables
(with the exception of :TERMINAL):
System Variables VPI VPIN System Variables
SR-Info/VP-Info Reference Manual Page 24 SECTION 2
1>LIST SYSTEM
Name Type Width Contents
:F1 C 5 HELP
:F2 C 10 LIST STRU;
:F3 C 6 WRITE
:F4 C 10 LIST MEMO;
:F5 C 7 BROWSE;
:F6 C 5 STAT;
:F7 C 12 ^wCONT;EDIT;
:F8 C 11 LOCATE FOR
:F9 C 5 FIND
:F10 C 5 EDIT;
:TIME C 8 16:45:20
:DATE C 21 Monday, July 30, 1990
:VERSION C 4 510
:SERIAL C 10 2934906400
:COMPANY C 14 D&G Book Store
:PICTURE C 10 9999999.99
:TITLE C 1
:UNDOC C 1
:KEY N 8 13
:AVAIL N 8 0
:FIELD N 8 0
:ERROR N 8 0
:MESSAGE C 1
:RETRY N 8 25
:USER N 8 1
:DIR C 6 C:\TMP
:NEAR N 8 0
:COLOR N 8 48
** Total ** 28 variables... 216 bytes
Function keys. :F1 to :F10 are the system variables activated by
pressing the keys <F1> to <F10>. They can be assigned values with the
commands =:
:F1='street'
or with the combination of Alt and function key. For instance, Alt-
F10 assigns the contents of the command line or editing field from the
beginning to the cursor to <F10>. See Section 1.2.
:DATE and :TIME. SR-Info/VP-Info stores the date and time
internally. When SR-Info/VP-Info is started, it reads the system date
and time. If you have a calendar card, the system date and time is
the current date and time; otherwise, the date is 01/01/80 (or later)
and the time is 00:00:00 at the time the computer was started. (You
can reset the system date and time with the operating system DATE and
TIME commands.)
System Variables VPI VPIN System Variables
SR-Info/VP-Info Reference Manual Page 25 SECTION 2
You can set SR-Info/VP-Info's date and time:
1>:DATE='04/05/84'
1>:TIME='08:12:56'
(mm/dd/yy and hh:mm:ss format).
The function TIME( returns the system time and sets :TIME to the
system time. The function DATE( with one parameter (the format)
returns the date from :DATE in a specific format and rewrites :DATE to
this format. (See Section 3.4.)
For instance,
1>stamp=TIME()
stores current system time to the memory variable STAMP, and resets
:TIME. The command
1>REPLACE stamp WITH TIME()
does the same for the field STAMP.
:PICTURE. The :PICTURE system variable is a format for numbers
(see Formatting numbers under the @ command). This formats the
display of all numeric memory variables and numeric expressions. This
format can be overridden by a format clause in TEXT or an @ command,
or with the PIC( function.
The system comes with :PICTURE as '999999.99'. If you want
higher precision, say three decimals:
1>:PICTURE='999999.999'
If you do not want fractions, but want millions:
1>:PICTURE='9999999'
The :PICTURE variable can contain format clauses with up to 12
9s, with at many as 6 on the right side of the decimal point.
It should be emphasized that the :PICTURE does not influence how
SR-Info/VP-Info stores or computes numbers; it only tells the language
how to display them.
Other system variables. :VERSION contains the current version
number of SR-Info/VP-Info.
:SERIAL may contain the serial number. Once SR-Info/VP-Info is
loaded, you may use this as a variable that survives a CLEAR command.
System Variables VPI VPIN System Variables
SR-Info/VP-Info Reference Manual Page 26 SECTION 2
:COMPANY contains the company name. This is used by the REPORT
command. (It can be changed to the name of the company you are
reporting on.)
:TITLE is the default title of a report. See the REPORT command.
:KEY is a numeric variable. It contains the number generated by
the last keystroke used to exit a process or execute a command. See
the function INKEY( for the definition of this number. :KEY is used
in SR-Info/VP-Info programming to find out which key was pressed to
abort or interrupt a procedure.
:AVAIL contains the number of the next available volume in the
current library file. See SET LIBRARY command.
:FIELD contains the number of the Get Table entry currently being
processed. See ON FIELD command; VP-Info Professional only.
:ERROR The current value of SR-Info/VP-Info's internal error
variable. Shows why execution of the last command failed.
:MESSAGE The message from the MSG file associated with the error
number contained in :ERROR
:RETRY Controls what happens during network operations under VP-
Info Professional Network Edition; has no meaning under other
versions.
:USER A number between 1 and 999 assigned to each user on a
network under VP-Info Professional Network Edition.
:DIR The user's current drive letter and directory.
:NEAR The number of the record containing a key equal to or
greater than the last FIND's FIND string. See FIND command.
:COLOR The current value of the color attribute written into the
screen memory for every byte of screen display; set with SET COLOR TO
or :COLOR= command.
System Variables VPI VPIN System Variables
SR-Info/VP-Info Reference Manual Page 27 SECTION 3
SECTION 3. SR-Info/VP-Info FUNCTIONS AND EXPRESSIONS
In SR-Info/VP-Info, expressions are formed from variables and
constants using operations, relations, and functions. Section 2.3
introduced variables. In this section, you will find the other
ingredients of expressions: constants, operations, relations, and
functions. Finally, the expressions themselves are discussed.
3.1. Constants
There are three types of constants: numeric, logical, and string.
A numeric constant is a number (the minus sign is a part of it):
12.78
0.00064
-3.14
There are only two logical constants: T (true, also written as
t, Y, and y) and F (false, also written as f, N, and n).
A string constant is a string in quotation marks:
"This is a character constant."
'This is another one, delimited with single quotation marks.'
"Here's another one, enclosing a single quotation mark (apostrophe)
within double quotes."
"This is incorrect because the quotation marks do not match.'
3.2. Operations
There are three types of operations: numeric, logical, and
string. Each works with constants and variables of that type, and
yields a value of that type.
The numeric operations are
+ addition
- subtraction
* multiplication
Operations Operations
SR-Info/VP-Info Reference Manual Page 28 SECTION 3
/ division
2+3.2 yields 5.2
10/4 yields 2.5
All numeric operations require two numbers to act on. - is also
used to indicate that a number is negative: -2, -3.14. Instead of
-QTY, write 0-QTY or -1*QTY.
There are three logical operations:
.AND.
.OR.
.NOT.
.AND. and .OR. take two logical values and yield a logical value:
T.AND.T yields: T
T.AND.F yields: F
F.AND.T yields: F
F.AND.F yields: F
T.OR.T yields: T
T.OR.F yields: T
F.OR.T yields: T
F.OR.F yields: F
.NOT. takes a logical value and yields a logical value (the
opposite):
.NOT.T yields: F
.NOT.F yields: T
There is only one string operation:
+ concatenation (placing one string after another)
'This is a'+' sentence.'
yields the value:
This is a sentence.
Note that one cannot mix numbers and strings:
2+'string'
will give a syntax error message (Error 1, see Appendix C).
Operations Operations
SR-Info/VP-Info Reference Manual Page 29 SECTION 3
3.3. Relations
A relation takes two numbers or two strings (compares them), and
yields a logical value (true or false).
There are six relations that compare numbers or strings:
= equal
< less than
<= less than or equal to
> greater than
>= greater than or equal to
<> not equal
For numbers, these have their usual meaning:
1<2 is true
2<1 is false
1.2<>5 is true
1.2>=1 is true
You should be careful when using = for numbers. Two numbers may
be displayed as equal while, in fact, they differ in the third or
fourth decimal place. Instead of
num1=num2
in many instances you could use
ABS(num1-num2) < 0.01
or
(PIC(num1-num2,'9999.99'))=0
For strings, string1=string2 is true if string2 is of the same
length as string1, and the characters of string1 equal the
corresponding characters of string2; if string2 has more characters,
string1=string2 is always false.
However, the result of comparing strings of unequal length, in
which all of string2 is exactly the same as the beginning of string1,
is affected by the setting of the "exact switch." If SET EXACT OFF,
then such string1=string2 is true,; with SET EXACT ON, it is false.
Examples:
SET EXACT OFF SET EXACT ON
Relations Relations
SR-Info/VP-Info Reference Manual Page 30 SECTION 3
'abc'='abc' true true
'abc '='abc' true false
'abc'='abc ' false false
'abc'='ab' true false
'ab'='abc' false false
To make sure that two strings are really equal, write
(string1=string2) .AND. (string2=string1)
or SET EXACT ON.
One way of remembering the above rule, is that string1=string2 if
FIND with string2 finds string1.
Although this definition of string1=string2 may at first sight
seem awkward, it may really be quite useful both in Conversational
SR-Info/VP-Info and in SR-Info/VP-Info programs. For instance, the
condition to select all customers (field: CUST) whose name starts with
P:
LEFT(cust,1)='P' (or less efficiently SUBSTR(cust,1,1)='P')
or
cust='P'
if SET EXACT OFF.
For strings, string1 < string2 means: in a dictionary, string1
would come before string2. Single characters are compared by their
ASCII value, see the functions CHR( and RANK(. string1 is compared to
string2 by comparing their first characters; if the first character of
string1 is less than the first character of string2, then string1 <
string2; if they are equal, then the second character of string1 is
compared to the second character of string 2, and so on. Examples:
'I am smaller' < 'I am bigger' is false
'David' < 'david' is true
'122' > '17' is false
'122' > '017' is true
'seven' > '7' is true
Note that in the ASCII sequence, all digits, 0 to 9, come before
all upper-case letters, A to Z, which, in turn, come before all lower-
case letters, a to z.
Note that strings and numbers cannot be mixed in these relations:
Relations Relations
SR-Info/VP-Info Reference Manual Page 31 SECTION 3
2 < '123'
gives a syntax error message (Error 1, see list of error messages in
Appendix).
3.4. Functions
A function is just like an operation; the addition operation (+)
requires two arguments (numbers) and returns their sum; a function
requires some arguments (0 to 3) and returns some value.
Every function has a type: numeric, string, or logical, depending
on the values it returns.
A function has arguments; the values put into the function
between the parentheses, separated by commas. SR-Info/VP-Info
functions have at most three arguments; a few have none. Some
arguments may be optional.
The arguments can be variables or expressions of type string:
<str var> or <str exp>, or of type numeric: <num var> or <num exp>.
(Expressions are discussed in Section 3.5.)
Functions Functions
SR-Info/VP-Info Reference Manual Page 32 SECTION 3
!(
Converts a string to upper case.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β !(<str exp>) β
β β
β <str exp> the text to be converted to upper case β
βββββββββββββββββββ β
β Type: character β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
All lower-case letters in the <str exp> are converted into upper
case by the !( function. See also the LOWER( function.
Examples:
1>a='Aa12b'
1>? !(a)
AA12B
1>? !('David!')
DAVID!
Note that only the lower-case letters are changed.
!( SRI VPI VPIN !(
SR-Info/VP-Info Reference Manual Page 33 SECTION 3
#
Gets the current record number.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β # β
βββββββββββββββββ β
β Type: numeric β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
This function returns the record number of the current record of
the selected file. Note that ? # displays the current record number
in the form specified by the system variable :PICTURE (see Section
2.7). SR-Info/VP-Info also has a more general form of this function,
RECNO(, which allows the user to specify file other than the selected
file.
When used with the option RECNO(filenum), it gives the record
number of the current record in file filenum.
Examples:
1>USE employee
1>? #
1.00
1>GO BOTTOM
1>? #
6.00
1>GO TOP
1>? #
1.00
1>SKIP 2
1>? #
3.00
SRI VPI VPIN #
SR-Info/VP-Info Reference Manual Page 34 SECTION 3
$(
Gets a substring of a string.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β $(<str exp>, <start num exp>, <width num exp>) β
β β
β <str exp> the string from which the new string is formed β
β <start num exp> the position from which the new string is β
β taken β
β <width num exp> the number of characters to place in the β
β new string β
βββββββββββββββββββ β
β Type: character β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
This function takes the string in <str exp> from position <start
num exp> (fractions are thrown away); the number of characters taken
is <width num exp>. (In both numeric expressions, the fractions are
disregarded).
Examples:
1>name='David Barberr'
1>? $(name, 7,3)
Bar
1>? $(name, 7,12)
Barberr
1>? LEN($(name,7,12))
7.00
Note that $(name,7,12) is of width 7, not 12; there are only 7
letters left in name from position 7.
1>s=3
1>t=1
1>? $(name+name, (s+t)/2, 1.9)
a
Note that 1.9 was taken as 1.
$( SRI VPI VPIN $(
SR-Info/VP-Info Reference Manual Page 35 SECTION 3
*
Determines whether a record is deleted.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β * β
βββββββββββββββββ β
β Type: logical β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
In the selected file, the current record pointer points at a
record. If this record has been marked for deletion (in BROWSE or
EDIT, or with the DELETE command), then * gives the value T;
otherwise, it is false.
Example:
1>USE employee
1>DELETE RECORD 2
1 DELETE(S)
1>GO 2
1>? *
T
* SRI VPI VPIN *
SR-Info/VP-Info Reference Manual Page 36 SECTION 3
@(
Gets the location of a substring.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β @(<find str exp>, <str exp>) β
β β
β <find str exp> the string searched for β
β <str exp> the text to be searched β
βββββββββββββββββ β
β Type: numeric β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
This function finds out whether a string: <find str exp> occurs
in the string: <str exp>. If it occurs, the function returns the
character position of the first (left-most) substring of <str exp>
which is the same as <find str exp>; if it does not occur, the
function returns a 0.
Examples:
1>greeting='Good morning'
1>? @('oo', greeting)
2.00
1>? @('good',greeting)
0.00
In a program:
IF @(answer,'YNQynq')=0
checks whether the user response is correct.
@( SRI VPI VPIN @(
SR-Info/VP-Info Reference Manual Page 37 SECTION 3
ASC(
Converts a character to its ASCII number.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ASC(<str exp>) β
β β
β <str exp> the first character of this string is converted β
βββββββββββββββββ β
β Type: numeric β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
The characters in the character set used by the computer are
numbered from 0 to 255. For the first character of the string
<str exp>, ASC( returns the corresponding number. RANK( is a synonym
for ASC(. See also the functions CHR(, CTONUM(, and NUMTOC(.
Examples:
1>? ASC('x')
120.00
1>? ASC('xyz')
120.00
Note that only the first character of the string matters.
ASC( SRI VPI VPIN ASC(
SR-Info/VP-Info Reference Manual Page 38 SECTION 3
AT(
Gets the location of a substring . . . a synonym for @(
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AT(<find str exp>, <str exp>) β
β β
β <str exp> the text to be searched β
β <find str exp> the string searched for β
βββββββββββββββββ β
β Type: numeric β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
This function is merely a synonym for @(. See @(.
AT( SRI VPI VPIN AT(
SR-Info/VP-Info Reference Manual Page 39 SECTION 3
BIT(
Bit-set function determines if a given bit is 0 or 1
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β BIT(<string>,<bit position>) β
β β
β <string> a string or string variable to test β
β <bit position> a numeric expression; position of a given bit β
β within <string> β
βββββββββββββββββββ β
β Type: logical β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
Each character in the ASCII character set is identified by an
eight-bit binary number from 0 to 255 inclusive. Each bit may be
either 0 or 1; for example, the letter A has a decimal value of 65 and
a binary value of 01000001.
When used with the SET( and RESET( functions, which turn specific
bits to 1 or 0 respectively, the BIT( function can be used to access
large amounts of logical data much more compactly than in a set of
logical variables. BIT( returns T (true) if the specified bit is set
(0), F (false) if not set (0).
Note: Bit positions are counted differently than in some other
schemes. In these functions, all bits are counted from the left of the
string starting at 1, so that each character contains bits numbered as
follows:
1. Bits 1 to 8.
2. Bits 9 to 16.
3. Bits 17 to 24.
. . . and so on
Example in a program:
To print the binary value of each character in an input string:
SET RAW ON ;eliminates spaces between listed output
DO WHILE t
ACCEPT 'Enter a short string for binary representation: ' TO string
IF string=' '
BREAK
ENDIF
?
REPEAT LEN(string)*8 TIMES VARYING position
?? IFF(BIT(string,position),'1','0')
IF MOD(position,8)=0
BIT( SRI VPI VPIN BIT(
SR-Info/VP-Info Reference Manual Page 40 SECTION 3
?? ' '
ENDIF
ENDREPEAT
ENDDO
Now run the program:
Enter a short string for binary representation: Bit
01000010 01101001 01110100
Enter a short string for binary representation:
BIT( SRI VPI VPIN BIT(
SR-Info/VP-Info Reference Manual Page 41 SECTION 3
BLANK(
Creates a string of blanks or other specified characters.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β BLANK(<num exp>[,<charnum>]) β
β β
β <num exp> a number from 0 to 255 β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β Option: β
β <charnum> the ASCII number of the character used to fill the β
β blank string; default is 32, the blank character β
βββββββββββββββββββ β
β Type: character β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
This function creates a string of <num exp> blanks or other
specified characters.
When charnum is specified, many interesting effects can be
created, particularly by using the special pattern characters in the
IBM screen character set, 176-178, and the solid block character, 219.
Examples:
1>name='DAVID'
1>? name+BLANK(15)+name
DAVID DAVID
1>num=23
1>? name+BLANK(num+5)+name
DAVID DAVID
1>? BLANK(20,65)
AAAAAAAAAAAAAAAAAAAA
BLANK( SRI VPI VPIN BLANK(
SR-Info/VP-Info Reference Manual Page 42 SECTION 3
CEN(
Centers a line of text.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CEN(<str exp>,<num exp>) β
β β
β <str exp> the text to be centered β
β <num exp> the line width β
βββββββββββββββββββ β
β Type: character β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
This function centers (from the present position) the text
<str exp> in a line (column) with <num exp> characters.
Examples:
1>compiler='SR-Info/VP-Info'
1>? CEN(compiler,40)
SR-Info/VP-Info
1>@ 10,20 SAY CEN('Center this',40)
Note: the last command centers the text between columns 20 and
60.
CEN( SRI VPI VPIN CEN(
SR-Info/VP-Info Reference Manual Page 43 SECTION 3
CHR(
Converts an ASCII number to character.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CHR(<num exp>) β
β β
β <num exp> a number from 0 to 255 β
βββββββββββββββββββ β
β Type: character β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
The characters in the character set used by the computer are
numbered from 0 to 255; this number for a character is called the
ASCII number. For a given <num exp> in this range, CHR(<num exp>) is
the corresponding character.
This function is useful to send control codes to the printer.
For instance,
1>? CHR(27)+CHR(120)+CHR(1)
puts the Epson LQ-1500 printer into letter quality mode.
The functions ASC( and RANK( do the reverse. These functions
combine nicely. If the memory variable LETTER contains a letter of
the alphabet (other than z or Z), then
LETTER=CHR(ASC(LETTER)+1)
places in LETTER the next letter of the alphabet.
Examples:
1.
1>? CHR(120)
x
1>letter='C'
1>? CHR(RANK(letter)+1)
D
2. To set a standard IBM or Epson printer into double-wide mode:
1>SET PRINT ON
1>? CHR(14)+'First line.'
prints:
CHR( SRI VPI VPIN CHR(
SR-Info/VP-Info Reference Manual Page 44 SECTION 3
First line. in double-wide characters
CHR( SRI VPI VPIN CHR(
SR-Info/VP-Info Reference Manual Page 45 SECTION 3
CLOSE(
Closes a DOS file.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLOSE([filenum]) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β Option: β
β β
β <filenum> the DOS file number (between 1 and 4) β
βββββββββββββββββ β
β Type: logical β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
This function closes the DOS file (in particular, the sequential
file) opened with the ROPEN( or WOPEN( function. It returns T if
successful, F otherwise. See the functions ROPEN(, WOPEN(, SEEK(,
SSEEK(, READ(, WRITE(, GET(, PUT(, IN(, OUT(, and CLOSE).
If filenum is not specified, filenum=1 is the default.
Example:
1>ok=ROPEN('a:label.prg',3)
1>? ok
T
1>ok=CLOSE(3)
CLOSE( SRI VPI VPIN CLOSE(
SR-Info/VP-Info Reference Manual Page 46 SECTION 3
COL(
Gets print column position.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β COL() β
βββββββββββββββββ β
β Type: numeric β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
This function gives the current column position of the cursor; if
the printer is on, it returns the column position of the printer head.
See the commands SET PRINT ON and SET FORMAT TO PRINT, and the
function ROW(.
Example:
@ ROW(),COL()+3 SAY 'Hello'
prints 'Hello' starting three characters to the right of the end of
the last printing.
COL( SRI VPI VPIN COL(
SR-Info/VP-Info Reference Manual Page 47 SECTION 3
CTONUM(
Convert a hexadecimal string into a decimal number.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CTONUM(<type>,<string exp>) β
β VP-Info Professional only β
β <type> the length of the numeric value to be returned β
β <string exp> the string to be evaluated as a hexadecimal value β
βββββββββββββββββββ β
β Type: numeric β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
A general conversion function for converting hexadecimal values
into decimal numbers. Input can be any length string or string
variable up to eight characters as follows:
Type String Length Returns
1 1 byte integer 0 to 255
2 2 bytes integer -32768 to 32767
4 4 bytes integer +/- 2 billion
8 8 bytes a floating point number
If string is shorter, conversion still assumes the string is the
format of the given width. When <type> is 1, this function is
equivalent to RANK( or ASC(.
The NUMTOC( and CHR( functions convert numbers into strings.
Do not confuse these function with STR( and VAL(, which convert
decimal numbers into their string representations, and vice versa.
Examples:
1>? CTONUM(1,'a')
97.00
1>? CTONUM(2,'ab')
25185.00
1>? CTONUM(4,'abc')
6513249.00
1>? CTONUM(4,'abcd') ;number too large for format in :PICTURE
**********
CTONUM( VPI VPIN CTONUM(
SR-Info/VP-Info Reference Manual Page 48 SECTION 3
Note to users of VP-Info Version 1:
Though not in the original Version 1 documentation, a function
called CONVERT( was added and documented in a disk file supplied to
later purchasers. This function was broken into two separate
functions, CTONUM( and NUMTOC(, in the current version. Existing
programs that use CONVERT( will have to be modified to work as
expected under the current versions.
CTONUM( VPI VPIN CTONUM(
SR-Info/VP-Info Reference Manual Page 49 SECTION 3
DATE(
Displays a date in a specific format.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DATE(<type>[,<str exp>]) β
β β
β <type> one of 9 type basic date-output formats β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β Option: β
β β
β <str exp> the date to be converted β
βββββββββββββββββββ β
β Type: character β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
This function with only <type> specified rewrites the current
system date in :DATE in the format specified by the <type>, and
displays the result.
This function with two parameters (the format and the date)
returns the given date in the specified format. :DATE is not
effected.
The <type> can be given in either of two forms, a name or number
(numeric expression) as follows:
Type Date-output format
1 or YMD 6-character format without slashes: yymmdd
2 or MDY 8-character format with slashes: mm/dd/yy
3 or Char Spelled out: Month dd, yyyy
4 or Full Spelled out: Weekday, Month dd, yyyy; valid only
for years 1980-2079
5 or Lchar Last day of month spelled out in format 3 (Char)
6 or DMY 11-byte string in format dd-MMM-yyyy (example
03-NOV-1990)
7 or Variable formatted without slashes according to SET DATE TO
command (See SET DATE TO)
8 or Long 8-character format without slashes: yyyymmdd
9 or Last Last day of month in format 1 (YMD) or 8 (Long),
depending on whether SET DATE TO command set
year to YY or YYYY
Shortcut: When specifying type by name, only the first character
is usually required. The exception is for Lchar, Long and Last,
which require two characters to resolve ambiguity. If only one is
given, Lchar is assumed.
DATE( SRI VPI VPIN DATE(
SR-Info/VP-Info Reference Manual Page 50 SECTION 3
<str exp> must contain the date in one of the following formats:
mmddyy ddmmyy yymmdd
mmddyyyy ddmmyyyy yyyymmdd
Optionally, a slash, a hyphen, or a space may be used to separate
the elements of these formats. For example, YY/MM/DD, YY-MM-DD,
DD MM YYYY are all equally valid.
There should be two digits each for month and the day, and two or
four digits for the year. 01 3 92 is not acceptable. If <str exp> is
not acceptable, then DATE( returns a string of blanks.
In the event of ambiguity, dates will be decoded in accordance
with the format set in the SET DATE TO command. For example:
SET DATE TO date is interpreted as Comment
'ddmmyy' 11/03/90 March 11, 1990
'mmddyy' 11/03/90 November 3, 1990
'mmddyy' 11/03/60 November 3, 2060 all dates
converted to
range 1980-2079
See also the system variable :DATE in Section 2 and the command
SET DATE TO.
Examples:
1>:DATE= '10/05/90'
1>? :DATE
10/05/90
1>? DATE()
19901005
1>? :DATE
19901005
1>? DATE(1)
901005
1>? :DATE
901005
1>? DATE(2)
10/05/90
1>? :DATE
10/05/90
1>? DATE(3)
October 5, 1990
1>? :DATE
October 5, 1990
1>? DATE(4)
Saturday, October 5, 1990
1>? :DATE
DATE( SRI VPI VPIN DATE(
SR-Info/VP-Info Reference Manual Page 51 SECTION 3
Saturday, October 5, 1990
1>? DATE(4,'12/08/90')
Sunday, December 8, 1990
1>? :DATE
Saturday, October 5, 1990
1>? DATE(5,'90-30-27')
March 31, 1990
1>? DATE(6,'03 27 90')
27-Mar-1990
1>? :DATE
Saturday, October 5, 1990
DATE( SRI VPI VPIN DATE(
SR-Info/VP-Info Reference Manual Page 52 SECTION 3
DAYS(
Computes dates and date differences in days.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DAYS(<str exp1>,<str exp2>) β
β DAYS(<str exp>,<num exp>) β
β β
β In the first form: β
β <str exp1> and <str exp2> are dates β
β In the second form: β
β <str exp> is a date and <num exp> is a number β
βββββββββββββββββββββββββββ β
β Type: numeric/character β β
βββββββββββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββ
In the first form, DAYS( returns the number of days between the
two dates. The result is an integer.
In the second form, DAYS( returns the date (as a string) which is
<num exp> days past or before the date <str exp>.
The string expressions containing dates can be of many different
formats (see the DATE( function for more examples):
yy/mm/dd yy-mm-dd yyyy mm dd
mm/dd/yy mm-dd-yy mm dd yy
There should be two digits each for yy, mm, and dd, and four
digits for yyyy. 01 3 90 is not acceptable.
In the second form, the date is returned in the format set with
the SET DATE TO command (default: mmddyyyy). If you wish a different
format, use the DATE( function. See also MONTHS( and SET DATE TO.
Examples:
1>? DAYS('04 06 90','04 29 90')
23.00
1>? DAYS('01/01/88','01 23 90')
753.00
1>? DAYS('01/01/90','01 23 88')
-708.00
1>? DAYS('01/01/91','01 02 91')
1.00
1>? DAYS('01/02/91','01 01 91')
-1.00
1>? DAYS('02/28/88','03 01 88') ;leap year
2.00
DAYS( SRI VPI VPIN DAYS(
SR-Info/VP-Info Reference Manual Page 53 SECTION 3
1>? DAYS('02/28/90','03 01 90') ;not a leap year
1.00
1>? DAYS('04 03 90',30)
050290
1>? DAYS('02 03 90',30)
030590
1>? DAYS('02 03 90',-3)
010490
1>? DAYS('020390',-30)
010490
1>monthday='0203'
1>offset=30
1>? DAYS(monthday+'90',offset+1)
030690
DAYS( and DATE( may be combined to form complex expressions. For
instance, the end of the month closest to today in the form set in the
SET DATE TO command:
DATE(7,DAYS(DATE(2),-15))
See DATE( and MONTHS( functions, and SET DATE TO command.
DAYS( SRI VPI VPIN DAYS(
SR-Info/VP-Info Reference Manual Page 54 SECTION 3
DBF(
Allows access to data-file attributes of a file in use.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DBF(<type>[,<filenum>]) β
β β
β <type> the information required from the data file header β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β Option: β
β β
β <filenum> the data file number; default is the currently β
β selected data file β
βββββββββββββββββββββββββββ β
β Type: character/numeric β β
βββββββββββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββ
Each data file has a file head which contains information about
its structure, most of which is displayed with the LIST STRUCTURE
command.
Using the DBF(, DBFX( and FLD( functions provides users access to
this information in a programmable form suitable for display and use
in expressions.
The <type> can be given in either of two forms, a name or number
(numeric expression) as follows:
Type Explanation Result
1 or Type file type ("1", "2" or "3") string
2 or Name data file name string
3 or Fields number of fields in structure integer
4 or Records number of records in file integer
5 or Indexes number of indexes currently open integer
6 or Master index number of master index integer
Shortcut: When specifying type by name, only the first character
is required.
Example:
1>? DBF(type),DBF(n),DBF(fields),DBF(recs),DBF(indexes),DBF(master)
1 CUSTOMER.DBF 9.00 4.00 2.00 1.00
DBF( SRI VPI VPIN DBF(
SR-Info/VP-Info Reference Manual Page 55 SECTION 3
Note to users of VP-Info Version 1:
The DBF( function, though not in the original Version 1
documentation, was added and documented in a disk file supplied to
later purchasers. Types 1 to 3 remain unchanged, but types 4 to 7 in
the original DBF( function are now types 1 to 4 of the FLD( function.
Existing programs that use DBF( may have to be modified to work as
expected under the current versions.
DBF( SRI VPI VPIN DBF(
SR-Info/VP-Info Reference Manual Page 56 SECTION 3
DBFX(
Gives additional information about an open data file; an extension to
the DBF( function.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DBFX(<type> [,<filenum>]) β
β VP-Info Professional only β
β <type> one of three types of information as listed below β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β Option: β
β β
β <filenum> the data file number; default is the currently β
β selected data file β
βββββββββββββββββββ β
β Type: logical β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
The DBF( and FLD( functions, available in both SR-Info and
VP-Info, provide information contained in the data file headers.
VP-Info Professional provides this extended function to give
three additional types of information in a programmable form suitable
for display and use in expressions.
The <type> can be given in either of two forms, a name or number
(numeric expression) as follows:
Type Explanation
1 or Filter TRUE if a FILTER is in effect
2 or Limit TRUE if a LIMIT is in effect
3 or Relation TRUE if file is related to another
Shortcut: When specifying type by name, only the first character
is required.
Examples:
1>SET FILTER TO state='CA'
1>? DBFX(filter)
T
1>? DBFX(r)
F
DBFX( VPI VPIN DBFX(
SR-Info/VP-Info Reference Manual Page 57 SECTION 3
DELETED(
Determines whether a record is deleted.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DELETED(<filenum>) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β Option: β
β β
β <filenum> the number of the data file to be checked β
βββββββββββββββββ β
β Type: logical β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
In a specified data file, the current record pointer points at a
record. If this record has been marked for deletion (in BROWSE or
EDIT, or with the DELETE command), then DELETED( gives the value T;
otherwise, it is false.
This is a more general firm of the * function, which operates the
same way as DELETED( but, because it allows no parameter, works only
with the currently selected data file.
Examples:
1>? DELETED(4)
T
DELETED( SRI VPI VPIN DELETED(
SR-Info/VP-Info Reference Manual Page 58 SECTION 3
DIR(
Get file information from disk directory.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DIR([<filespec>]) β
β β
β Option: β
β β
β <filespec> a string or string expression containing a file name β
β (or skeleton using ? and/or * wildcards), with β
β optional drive and/or path specification β
βββββββββββββββββββ β
β Type: character β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
Searches for specific files specified by the drive path,
subdirectory and/or filename and provides specific information on
files found.
If an argument is given, it must be a string or string expression
naming a file, with * and ? wildcards optional). Returns the first
file name found matching <filespec>. If no match was found, blank is
returned.
If no argument is given, the previous <filespec> is used to find
the next matching file. If no more matching file names are found,
blank is returned.
Examples:
DIR('c:\path\*.bak')
locates the first file with extension BAK in the subdirectory \PATH,
while
DIR('*.bak')
locates the first file with extension BAK in the current directory.
If a file is found with Form 1, entering DIR() with no parameters
will locate the next file meeting the <filespec>. This will continue
until the response is a blank, indicating there are no more files
meeting the <filespec>.
Note to users of VP-Info Version 1:
The DIR( function, though not in the original Version 1
documentation, was added and documented in a disk file supplied to
DIR( SRI VPI VPIN DIR(
SR-Info/VP-Info Reference Manual Page 59 SECTION 3
later purchasers. One of the forms of the original DIR( function has
been made into a separate function, DIRX(. Existing programs that use
DBF( may have to be modified to work as expected under the current
versions.
DIR( SRI VPI VPIN DIR(
SR-Info/VP-Info Reference Manual Page 60 SECTION 3
DIRX(
Obtain additional information about file located with the DIR(
function.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DIRX(<type>) β
β VP-Info Professional only β
β <type> the name or number of the information required about β
β a file β
βββββββββββββββββββββββββββ β
β Type: character/numeric β β
βββββββββββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββ
Once a file is identified with DIR(, additional information can
be obtained from the DOS directory in a form suitable for use in a
program.
The <type> can be given in either of two forms, a name or number
(numeric expression) as follows:
Type Explanation Result
1 or Name last file name found with DIR( string
2 or Size size in bytes of last name found
with DIR( integer
3 or Attribute DOS file attribute as follows integer
1 - directory
2 - system
3 - hidden
4 - read only
5 - normal
4 or Time time file created or last updated string
5 or Date date file created or last updated string
Shortcut: When specifying type by name, only the first character
is required.
These functions have many uses. Use them to write a program that
backs up recently modified files, a program that lists files so the
user can pick one, etc.
Examples:
DIR(n) returns the filename
DIR(a) returns 4 if the file is read only
DIRX( VPI VPIN DIRX(
SR-Info/VP-Info Reference Manual Page 61 SECTION 3
EOF
Gives the end-of-file flag for the currently selected data file.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β EOF β
βββββββββββββββββ β
β Type: logical β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
If the current record pointer is on the last record of the file
in use and a SKIP is issued, EOF returns T (true); otherwise it is F
(false). Since SKIP n is treated as n SKIP commands, EOF returns true
if SKIP n goes past the last record. Also, if a LOCATE or CONTINUE
command is unsuccessful, or if NEAREST does not find an index key
equal to or greater than the FIND string, EOF returns T.
Examples:
1>USE employee
1>GO 4
1>SKIP 2
1>? #
6.00
1>? EOF
F
1>SKIP
1>? EOF
T
1>GO 4
1>SKIP 3
1>? #
6.00
1>? EOF
T
EOF SRI VPI VPIN EOF
SR-Info/VP-Info Reference Manual Page 62 SECTION 3
EOF(
Gives the end-of-file flag for a specified data file.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β EOF([<filenum>]) β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β Option: β
β β
β <filenum> the number of the data file to be checked β
βββββββββββββββββββ β
β Type: logical β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
For the data file number specified, if the current record pointer
is on the last record and a SKIP is issued, EOF( returns T (true);
otherwise it is F (false). Since SKIP n is treated as n SKIP
commands, EOF( returns true if SKIP n goes past the last record.
Also, if a LOCATE or CONTINUE command is unsuccessful, or if
NEAREST does not find an index key equal to or greater than the FIND
string, EOF( returns T.
An extended form of the EOF( function which, since it takes no
parameter, works only on the currently selected data file. If no
<filenum> is specified, the current file is assumed.
Examples:
1>USE employee
1>GO 4
1>SKIP 2
1>? #
6.00
1>? EOF()
F
1>SELECT 2
2>SKIP
2>? EOF()
T
2>GO BOTTOM
2>SKIP
2>? #
6.00
2>SELECT 1
1>? EOF(2)
T
EOF( SRI VPI VPIN EOF(
SR-Info/VP-Info Reference Manual Page 63 SECTION 3
FIELD(
Get the number of the Get Table entry corresponding to a variable or
field name.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FIELD(<name>) β
β β
β <name> the name of field or variable in a Get Table β
βββββββββββββββββββ β
β Type: numeric β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
While in full-screen editing mode (with READ, BROWSE, EDIT,
etc.), each input variable and field is put into a Get Table that can
be controlled with an ON FIELD structure.
FIELD( returns the number from 1 to 64 of any editing field on
screens created with @ GET and TEXT macros. This function is usually
used on an ON FIELD structure to redirect the sequence of data entry.
See READ and ON FIELD in the Command Reference section.
Example in a program:
ON FIELD
FIELD qty
IF qty<0
@ 22,0 say CEN('Quantity cannot be negative. Press any key',80)
cc=INKEY()
ERASE 22,22
:FIELD=FIELD(qty)
ENDIF
ENDON
FIELD( SRI VPI VPIN FIELD(
SR-Info/VP-Info Reference Manual Page 64 SECTION 3
FILE(
Verifies whether a file exists.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FILE(<str exp>) β
β β
β <str exp> file name β
βββββββββββββββββ β
β Type: logical β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
This function looks up the file whose name is given by <str exp>;
if the file is found, the function returns T, otherwise it returns F.
If no extension is given in the file name, DBF is assumed (a data
file is looked for). See also SET DEFAULT TO for the default drive.
Examples:
1>? FILE('employee')
T
1>? FILE('a:read.me')
T
1>mfile='read.me'
1>? FILE(mfile)
F
1>? FILE('a:'+mfile)
T
FILE( SRI VPI VPIN FILE(
SR-Info/VP-Info Reference Manual Page 65 SECTION 3
FLD(
Get information about a field in a data file.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FLD(<type>,<fieldnum> [,<filenum>]) β
β β
β <type> one of the four attributes of a field β
β <fieldnum> the number of the field to be checked β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β Option: β
β β
β <filenum> the number of the data file to be checked β
βββββββββββββββββββββββββββ β
β Type: character/numeric β β
βββββββββββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββ
Each field in a data file has four attributes as shown with the
LIST STRUCTURE command: name, type, width and (for numeric variables)
number of decimal places. The FLD( function is often used in
conjunction with the DBF( function.
These attributes can be retrieved in a form suitable for use in a
program with the FLD( function.
The <type> can be given in either of two forms, a name or number
(numeric expression) as follows:
Type Explanation Result
1 or Name string containing field name string
2 or Type string containing field type string
3 or Width number containing width of field integer
4 or Decimals number of decimal places in field integer
Shortcut: When specifying type by name, only the first character
is required.
Example in a program:
REPEAT DBF(records) TIMES varying fldnum
REPEAT 4 times VARYING type
?? FLD(type,fldnum)
ENDREPEAT
?
ENDREPEAT
FLD( SRI VPI VPIN FLD(
SR-Info/VP-Info Reference Manual Page 66 SECTION 3
GET(
Gets a string from a DOS file.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β GET(<str var>,<width num exp>[,filenum]) β
β β
β <str var> stores the string β
β <width num exp> the width of the string requested; β
β must be in range 1 to 254 β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β Option: β
β β
β filenum the DOS file number (between 1 and 4) β
βββββββββββββββββ β
β Type: logical β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
This function imports a string of <width num exp> characters from
a DOS file opened with the ROPEN( function; the character number
pointer is normally positioned with the SEEK( function.
If successful in getting all the bytes requested, GET( returns T
(true) and sets <str var> to the string imported from the file. If
<str var> does not exist, GET( will create it.
If the function is unsuccessful, it returns F (false). This will
be the result if the GET( function tries to get data beyond the end of
the file. Note, however, that even if GET( returns F, one of more
characters may still have been imported from the file; it is wise to
check the value and width of <str var> to ensure part of a file is not
lost.
If filenum is not given, filenum=1 is assumed.
GET( READ(, IN(, and WRAP( are the only functions that change the
contents of the memory variable used as an argument.
See also the functions ROPEN(, WOPEN(, CLOSE(, SEEK(, PUT(.
Example in a program:
IF ROPEN('test',3)
DO WHILE GET(string,80,3)
? string
ENDDO
ENDIF
ok=CLOSE(3)
GET( SRI VPI VPIN GET(
SR-Info/VP-Info Reference Manual Page 67 SECTION 3
IFF(
Allows IF...THEN logic in expressions.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β IFF(<cond>,<exptrue>,<expfalse>) β
β β
β <cond> a logical expression β
β <exptrue> the expression to be returned if <cond> is TRUE β
β <expfalse> the expression to be returned if <cond> is FALSE β
βββββββββββββββββββββββββββββββββββ β
β Type: character/numeric/logical β β
βββββββββββββββββββββββββββββββββββ§βββββββββββββββββββββββββββββββββββ
This function returns <exptrue> if <cond> is true, <expfalse>
otherwise. The type of the value returned is the same as the
expression selected by the condition.
IFF( is very useful in the FIELDS line of reports or in commands such
as SUM, AVERAGE, REPLACE, or LIST.
Examples:
1>? IFF(married,'Married','Single ')
1>SUM IFF(quant>500, quant*price, 0),IFF(state='NY',1,0)
The first command prints "Married" or "Single" according to the
value of a logical field named MARRIED. The second command will return
the sum of all quantities for transactions where quantity is greater
than 500, and a count of all records where STATE='NY', thus combining
two separate commands (SUM FOR and COUNT FOR) into one.
Caution: do not use expressions of different types or widths
in reports, since this may cause the REPORT command to fail.
IFF( SRI VPI VPIN IFF(
SR-Info/VP-Info Reference Manual Page 68 SECTION 3
IN(
Inputs a single character from a sequential file.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β IN(<str var>[,<filenum>]) β
β β
β <str var> stores the character β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β Option: β
β β
β <filenum> the DOS file number (between 1 and 4) β
βββββββββββββββββ β
β Type: logical β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
This function reads the next character of the DOS file (opened
with the ROPEN( function) into the string variable <str var>; if
<str var> does not exist, it will be created. <str var> cannot be a
matrix variable.
If filenum is not given, filenum=1 is assumed. IN( returns T if
successful, F otherwise.
This function is especially useful to communicate over the
standard COM1, COM2 devices, for conversion of Word Star or other non-
standard files to standard ASCII files, to encrypt/decrypt a file
through a translation table.
IN(, GET(, READ(, and WRAP( are the only functions that change
the contents of the memory variable used as an argument.
See the functions OUT(, ROPEN(, WOPEN(, SEEK(, SSEEK(, and
CLOSE(.
IN( SRI VPI VPIN IN(
SR-Info/VP-Info Reference Manual Page 69 SECTION 3
IFKEY(
Tests if a character is waiting in the keyboard buffer.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β IFKEY() β
β VP-Info Professional only β
βββββββββββββββββββ β
β Type: logical β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
It is often useful to test whether a key has been pressed on the
keyboard without waiting indefinitely if a key is not pressed.
The IFKEY( function returns T (true) if a keystroke is waiting in
the keyboard buffer, F (false) if not. The keyboard buffer is not
affected.
Example in a program, to create a timing loop that ends as soon
as any key is pressed:
start=VAL(TIME(seconds))
DO WHILE VAL(TIME(seconds))-start<3
IF IFKEY()
BREAK
ENDIF
ENDDO
IFKEY( VPI VPIN IFKEY(
SR-Info/VP-Info Reference Manual Page 70 SECTION 3
INKEY(
Waits and gets numeric value of keyboard entry.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β INKEY() β
βββββββββββββββββ β
β Type: numeric β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
This function suspends program execution until a key is pressed.
It returns a number identifying the key. Nothing is displayed on the
screen. Any key can be read (except Alt, Ctrl, and shift which merely
affect the characters produced by other keys) including all function
keys, editing keys, and alternate keys. (Function keys F11 and F12
are not recognized by many computers' BIOS programs, and are ignored
by SR-Info/VP-Info.)
Standard keys are identified with their ASCII number; see the
functions CHR( and ASC(. Other keys return values between 256 and
511.
Examples:
Key INKEY()
Ctrl-C 3
A 65
Alt-A 285
<F1> 315
Shift-<F1> 340
Ctrl-<F1> 350
Alt-<F1> 360
To find out the number identifying a key, give the command:
1>? INKEY()
and press <ENTER>, then the key; the character's number will be
displayed.
Using INKEY() the user can program his own EDIT, set up cursor
controlled menus, and so on.
INKEY( SRI VPI VPIN INKEY(
SR-Info/VP-Info Reference Manual Page 71 SECTION 3
INSERT(
Overwrites a string at a given position with another string.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β INSERT(<str expover>,<str exp>,<num exp>) β
β β
β <str expover> the string expression to overwrite β
β <str exp> the string expression to overwrite with β
β <num exp> the position β
βββββββββββββββββββ β
β Type: character β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
This function takes the string in <str expover> and overwrites
the string with <str exp> starting at position <num exp>.
Examples:
1>line=' '
1>customer='John Smith'
1>ponumber='32109'
1>amount='910.56'
1>line=INSERT(line,customer,1)
1>? line
John Smith
1>line=INSERT(line,ponumber,15)
1>? line
John Smith 32109
1>line=INSERT(line,amount,25)
1>? line
John Smith 32109 910.56
1>line=' c '
1>newline=INSERT(line,customer,@('c',line))
1>? newline
John Smith
Note: The last example shows the use of INSERT( with "templates".
The line variable is the template. The character "c" in it designates
the place where the customer has to be inserted. Such templates are
useful in report generators or for creating screen displays.
INSERT( SRI VPI VPIN INSERT(
SR-Info/VP-Info Reference Manual Page 72 SECTION 3
LEFT(
Gets the left part of a string.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β LEFT(<str exp>, <num exp>) β
β β
β <str exp> the string from which the new string is formed β
β <num exp> the number of characters to place in the new string β
βββββββββββββββββββ β
β Type: character β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
This function takes the first <num exp> characters from the
string <str exp>. It is equivalent to, but more efficient than,
$(<str exp>, 1, <num exp>).
If <num exp> is greater than the width of <str exp>, this
function returns all of <str exp>.
Wherever an expression calls for a substring starting at the
beginning, use LEFT instead of $( or SUBSTR(.
Example:
1>a='David Bark'
1>? LEFT(a,5)
David
1>? LEFT(a,50)
David Bark
LEFT( SRI VPI VPIN LEFT(
SR-Info/VP-Info Reference Manual Page 73 SECTION 3
LEN(
Gets the width (length) of a string.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β LEN(<str exp>) β
β β
β <str exp> the string β
βββββββββββββββββ β
β Type: numeric β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
This function returns the width (including trailing blanks) of
the string <str exp>.
Examples:
1>name='David Barberr'
1>? LEN(name)
13.00
1>? LEN(name+' is a nice boy')
27.00
Note that the width of a string is at least 1!
LEN( SRI VPI VPIN LEN(
SR-Info/VP-Info Reference Manual Page 74 SECTION 3
LOC(
Gets the current byte position in a file opened with ROPEN( or WOPEN(.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β LOC([<filenum>]) β
β β
β Option: β
β β
β <filenum> the number of the sequential or random file, 1 to 4 β
β (default 1) β
βββββββββββββββββββ β
β Type: numeric β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
Whenever a file is opened with the ROPEN( or WOPEN( function,
SR-Info/VP-Info maintains a pointer at a current position, which is
where any PUT( or GET( function would take effect. The position
pointer is set with the SEEK( and SSEEK( functions, and reset every
time the IN(, OUT, READ(, WRITE(, PUT(, and GET( function is used.
If filenum is not given, filenum=1 is assumed.
A common use of LOC( is to get the current position before a
SEEK( so that the pointer can be reset to the original position after
some operation.
LOC( SRI VPI VPIN LOC(
SR-Info/VP-Info Reference Manual Page 75 SECTION 3
LOWER(
Converts a string to lower case.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β LOWER(<str exp>) β
β β
β <str exp> the text to be converted to lower case β
βββββββββββββββββββ β
β Type: character β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
All upper-case letters in the <str exp> are converted into lower
case by the LOWER( function. See also the !( and UPPER( functions.
Examples:
1>a='Aa12b'
1>? LOWER(a)
aa12b
1>? LOWER('David!')
david!
Note that only the upper-case letters, A-Z, are changed (to a-z).
No other characters are affected.
LOWER( SRI VPI VPIN LOWER(
SR-Info/VP-Info Reference Manual Page 76 SECTION 3
LTRIM(
Trims blanks from the left-hand side of a string.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β LTRIM(<str exp>) β
β β
β <str exp> the string to be trimmed β
βββββββββββββββββββ β
β Type: character β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
This function gets rid of the blanks on the left of a string.
See also TRIM(.
Examples:
1>a=' David '
1>? a
David
1>? LEN(a)
14.00
1>? LTRIM(a)+' is trimmed on the left'
David is trimmed on the left
1>? LEN(LTRIM(a))
9.00
1>blank=' '
1>? LEN(LTRIM(blank))
1.00
Note: LTRIM(blank) is a single blank.
LTRIM( SRI VPI VPIN LTRIM(
SR-Info/VP-Info Reference Manual Page 77 SECTION 3
Math Functions
Mathematical functions package.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Logarithmic functions: β
β EXP( e-th power β
β LOG( natural logarithmic function β
β LOG10( base 10 logarithmic function β
β POW( power β
β SQRT( square root β
β β
β Trigonometric functions: β
β SIN( sine β
β COS( cosine β
β TAN( tangent β
β ASIN( arc sine β
β ACOS( arc cosine β
β ATAN( arc tangent β
β β
β Hyperbolic functions: β
β SINH( hyperbolic sine β
β COSH( hyperbolic cosine β
β TANH( hyperbolic tangent β
β β
β Integer valued functions: β
β β
β CEIL( ceiling integer β
β FLOOR( floor integer β
β INT( integer part β
β β
β Real valued functions: β
β ABS( absolute value β
β MOD( modulo value β
βββββββββββββββββ β
β Type: numeric β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
The mathematical functions are divided into five groups:
Logarithmic functions:
EXP(<num exp>) e to the power <num exp>
LOG(<num exp>) natural logarithm of <num exp>
LOG10(<num exp>) base 10 logarithm of <num exp>
POW(<num exp1>,<num exp2>) <num exp1> to the power <num exp2>
SQRT(<num exp>) square root of <num exp>
Math Functions SRI VPI VPIN Math Functions
SR-Info/VP-Info Reference Manual Page 78 SECTION 3
Trigonometric functions:
SIN(<num exp>) sine of <num exp> in radians
COS(<num exp>) cosine of <num exp> in radians
TAN(<num exp>) tangent of <num exp> in radians
ASIN(<num exp>) arc sine of <num exp>; returns a value
in radians between -Ο/2 and Ο/2
ACOS(<num exp>) arc cosine of <num exp>; returns a
value in radians between 0 and Ο
ATAN(<num exp>) arc tangent of <num exp>; returns a
value in radians between -Ο/2 and
Ο/2
Hyperbolic functions:
SINH(<num exp>) hyperbolic sine of <num exp>
COSH(<num exp>) hyperbolic cosine of <num exp>
TANH(<num exp>) hyperbolic tangent of <num exp>
Integer-valued functions:
CEIL(<num exp>) ceiling integer: the integer equal to
or just above <num exp>
FLOOR(<num exp>) floor integer: the integer equal to or
just below <num exp>
INT(<num exp>) the integer part of <num exp> (the
fractional part is discarded)
Note that for positive numbers, INT( and FLOOR
return the same result, but for negative numbers,
INT( and CEIL( produce the same result. This is
because discarding the decimal part of a real
number reduces its distance from zero.
Real-valued functions:
ABS(<num exp>) absolute value of <num exp>
MOD(<num exp1>,<num exp2>) <num exp1> modulo <num exp1>: returns
0 if <num exp2> is 0; returns the
value num with the same sign as
<num exp1>, less than <num exp2>,
satisfying
<num exp1>=i*<num exp2>+num
for some integer i.
Math Functions SRI VPI VPIN Math Functions
SR-Info/VP-Info Reference Manual Page 79 SECTION 3
Examples:
1>:PICTURE='999.999999'
1>? EXP(1)
2.718282 this is the value of e
1>? LOG(3)
1.098612
1>? LOG10(3)
0.477121
1>? POW(2,4)
16.000000
1>? POW(2,.5)
1.414214
1>? SQRT(4)
2.000000
1>? SQRT(2)
1.414214
1>? SIN(2) 2 is in radians
0.909297
1>? ASIN(1)
1.570796
1>? 2*ASIN(1)
3.141593 this is, of course, Ο; store this to
a variable if you need Ο
1>? CEIL(3.14)
4.000000
1>? FLOOR(3.14)
3.000000
1>? INT(23.45)
23.000000
1>? INT(-23.45)
-23.000000
1>x=23.45
1>? INT(10*x)
234.000000
1>x=23.999
1>? INT(x)
23.000000
1>? INT(3.14)
3.000000
1>? FLOOR(-3.14)
-4.000000
1>? INT(-3.14) note that for negative numbers, INT(
-3.000000 and FLOOR( give different values
1>? MOD(5,2) this is the remainder of 5
1.000000 divided by 2
1>? MOD(-3.14, .7)
-0.340000
1>? ABS(-3.14)
3.140000
Math Functions SRI VPI VPIN Math Functions
SR-Info/VP-Info Reference Manual Page 80 SECTION 3
1>:PICTURE='9999999.99'
1>x=15.689
1>? INT(x*100+.5)/100 Note: this is how to round to the
15.69 nearest penny
1>x=15.244
1>? INT(x*100+.5)/100
15.24
Math Functions SRI VPI VPIN Math Functions
SR-Info/VP-Info Reference Manual Page 81 SECTION 3
MAX(
Compare two expressions of any type and return the larger.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MAX(<exp1>,<exp2>) β
β β
β <exp1> any expression β
β <exp2> any expression of the same type as <exp1 β
βββββββββββββββββββββββββββββββββββ β
β type: character/numeric/logical β β
βββββββββββββββββββββββββββββββββββ§βββββββββββββββββββββββββββββββββββ
Given any two expressions of the same type, MAX( returns the
higher value. It must be remembered that string comparisons are based
on the ASCII value of the characters in the two strings. Comparing
two logical expressions has no meaning.
Examples:
1>? MAX('hello','goodbye')
hello
MAX( SRI VPI VPIN MAX(
SR-Info/VP-Info Reference Manual Page 82 SECTION 3
MENU(
Lightbar menu function; allows point-and-shoot selection from an on-
screen menu.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MENU(<choices>,<width>) β
β β
β <choices> the number of choices offered by the menu β
β <width> the width of the menu lightbar β
βββββββββββββββββββ β
β Type: numeric β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
The MENU( function pauses program execution and superimposes a
movable lightbar (reverse-video line) over a menu of selections
previously written to the screen, usually with TEXT.
The menu lightbar is moved up and down with the <Up> and <Dn>
keys. If you press <Dn> while on the bottom, the lightbar cycles
automatically to the top. Similarly, pressing <Up> while on the top
cycles to the bottom.
The user can select any item by moving the lightbar over it and
pressing <ENTER>, or entering its line number as a one-digit number.
In either case, the line number selected is returned by the function,
and the key pressed stored in the system variable :KEY. Both the
function value and :KEY can be tested in a subsequent DO CASE
structure to determine the program's next actions.
If the user presses 0 or <Home>, MENU( returns zero, although the
first line covered by the lightbar is 1. Options over 9 can be
accessed only by the lightbar.
If any cursor key except <Up>, <Dn> and <Home> is pressed, MENU(
returns the number of the line highlighted by the lightbar, and :KEY
contains the key number that would be returned by the INKEY( function.
(If SET FUNCTION OFF, all function keys have the same effect as these
cursor keys.)
While the MENU( function is active, all other typewriter keys are
ignored.
Examples:
1. This is a program which shows specifically the values returned
by Menu( when any key is pressed:
MENU( SRI VPI VPIN MENU(
SR-Info/VP-Info Reference Manual Page 83 SECTION 3
CLS
@ 19,46 say 'Returns'
@ 19,64 say ':KEY'
DO WHILE t
CURSOR 5,20
var=MENU(10,20)
@ 20,50 say var
@ 20,65 say :KEY
ENDDO
2. In a real-life program:
ERASE
WINDOW 1,2,23,77 double ;draw frame around screen
@ 1,3 say DATE(full)
@ 3,3 say CEN(:company,74)
@ 5,3 say CEN('Payroll Menu',74)
WINDOW 8,25,22,75 blank ;use WINDOW to position TEXT
TEXT paymenu ;menu text in external file
WINDOW
CURSOR 10,23
ans=MENU(8,35)
IF ans=0 .or. :key=335
CHAIN MENU
ENDIF
@ ans+9,23 say CHR(16) ; character as pointer
DO CASE
CASE ans=1
... etc.
MENU( SRI VPI VPIN MENU(
SR-Info/VP-Info Reference Manual Page 84 SECTION 3
MIN(
Compare two expressions of any type and return the smaller.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MIN(<exp1>,<exp2>) β
β β
β <exp1> any expression β
β <exp2> any expression of the same type as <exp1> β
βββββββββββββββββββββββββββββββββββ β
β Type: character/numeric/logical β β
βββββββββββββββββββββββββββββββββββ§βββββββββββββββββββββββββββββββββββ
Given any two expressions of the same type, MIN( returns the
lower value. It must be remembered that string comparisons are based
on the ASCII value of the characters in the two strings. Comparing
two logical expressions has no meaning.
Examples:
1>? MIN('Hello','Goodbye')
Goodbye
MIN( SRI VPI VPIN MIN(
SR-Info/VP-Info Reference Manual Page 85 SECTION 3
MONTHS(
Computes date differences in months.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MONTHS(<date1>,<date2>/<num exp>) β
β β
β <date1> a string expression containing a valid date β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β Options: β
β β
β <date2> a string expression containing a valid date; when β
β <date2> is specified, MONTHS( returns number of β
β months between the two dates β
β <num exp> number of months before or after date1; when β
β specified, MONTHS( returns date that many months β
β away β
ββββββββββββββββββββββββββββ β
β Type: character/numeric β β
ββββββββββββββββββββββββββββ§ββββββββββββββββββββββββββββββββββββββββββ
MONTHS( computes the difference between the two dates in months,
or computes a date a given number of months before or after a
specified date. Fractional parts of months are discarded.
If a computed date is after the last date of the month, the date
will be adjusted to the last day of the month. For example,
MONTHS('013190',1) results in 022890.
Examples:
1>? MONTHS('04 06 90','04 29 90')
0.00
1>? MONTHS('01/01/90','02/01/90')
1.00
1>? MONTHS('02/01/90','01/01/90')
-1.00
1>? MONTHS('01/01/90','01/01/92')
24.00
1>? MONTHS('02/01/90',10)
120190
1>? MONTHS('01/01/90',-6)
070189
MONTHS( SRI VPI VPIN MONTHS(
SR-Info/VP-Info Reference Manual Page 86 SECTION 3
NDX(
Get information on index files in use.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β NDX(<type>,<indexnum> [,<filenum>]) β
β VP-Info Professional only β
β <type> the name or number of the information required β
β <indexnum> the number of the index being checked (1 to 7) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β Option: β
β β
β <filenum> the number of the data file to be checked β
βββββββββββββββββββββββββββ β
β Type: character/logical β β
βββββββββββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββ
NDX( is used to primarily in programs to get the information on
the current environment in a form suitable for use in expressions.
The <type> can be given in either of two forms, a name or number
(numeric expression) as follows:
Type Explanation Result
1 or Name name of index file string
2 or Key key on which index was created string
3 or DBF_Name name of data file on which index
was created string
4 or Filter TRUE if filter or FOR clause was
in effect when index was created logical
Shortcut: When specifying type by name, only the first character
is required.
Examples:
1>? NDX(n),NDX(key),NDX(dbf),NDX(filter)
CUST1.NDX CUSTNUM CUSTOMER.DBF F
NDX( VPI VPIN NDX(
SR-Info/VP-Info Reference Manual Page 87 SECTION 3
NUMTOC(
Convert a decimal number to a hexadecimal string.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β NUMTOC(<type>,<number>) β
β VP-Info Professional only β
β <type> the length of the string to be created β
β <number> the number to be converted β
βββββββββββββββββββ β
β Type: character β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
A general conversion function for converting decimal numbers into
hexadecimal values. Input can be any number, and the returned string
length can be up to eight characters as follows:
The <type> can be given in either of two forms, a name or number
(numeric expression) as follows:
Type Range of Number String Length Returned
1 integer 0 to 255 1 byte
2 integer -32768 to 32767 2 bytes
4 integer +/- 2 billion 4 bytes
8 a floating point number 8 bytes
Shortcut: When specifying type by name, only the first character
is required.
Types 1, 2 and 4 return hexadecimal integers. Any fractional
parts are ignored.
When <type> is 1, this function is equivalent to CHR(. Values
outside the range of 0 to 155 return the modulus of 256 for type 1.
The CTONUM(, RANK( and ASC( functions convert strings into
numbers.
Do not confuse these function with STR( and VAL(, which convert
decimal numbers into their string representations, and vice versa.
Examples:
1>? NUMTOC(1,97)
a
1>? NUMTOC(2,25185)
ab
1>? NUMTOC(4,6513249)
NUMTOC( VPI VPIN NUMTOC(
SR-Info/VP-Info Reference Manual Page 88 SECTION 3
abc
Note to users of VP-Info Version 1:
Though not in the original Version 1 documentation, a function
called CONVERT( was added and documented in a disk file supplied to
later purchasers. This function was broken into two separate
functions, CTONUM( and NUMTOC(, in the current version. Existing
programs that use CONVERT( will have to be modified to work as
expected under the current versions.
NUMTOC( VPI VPIN NUMTOC(
SR-Info/VP-Info Reference Manual Page 89 SECTION 3
OUT(
Outputs a single character to a sequential file.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β OUT(<str var> [,<filenum>]) β
β β
β <str var> contains the character β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β Option: β
β β
β (filenum> the DOS file number (between 1 and 4) β
βββββββββββββββββ β
β Type: logical β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
This function outputs the character in <str var> to the
sequential file (opened with the WOPEN( function).
If filenum is not given, filenum=1 is assumed. OUT( returns T if
successful, F otherwise.
This function is especially useful to communicate over the
standard COM1, COM2 devices, for conversion of Word Star or other non-
standard files to standard ASCII files, to encrypt/decrypt a file
through a translation table.
See the functions IN(, ROPEN(, WOPEN(, CLOSE(, SEEK(, SSEEK(,
READ(, and WRITE(.
OUT( SRI VPI VPIN OUT(
SR-Info/VP-Info Reference Manual Page 90 SECTION 3
PIC(
Formats a number or string.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β PIC(<exp>,<format>) β
β β
β <exp> is the number or string to be formatted β
β <format> the format clause β
βββββββββββββββββββ β
β Type: character β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
This function returns the <exp> formatted with the format clause
<format>. See the command @ for the description of the format
clauses. PIC( is especially useful in preparing numeric values for
printing.
PIC( always returns a string, even when a number or numeric
expression is being formatted.
Examples:
1>number=1123.89
1>format='9,999.99'
1>? PIC(number,format)
1,123.89
1>format='9999'
1>? PIC(number,format)
1123
1>format='$$$,$$$.99'
1>? PIC(number,format)
$1,123.89
1>format='$$$,$$$.999'
1>? PIC(number,format)
$1,123.89
1>string='abcd'
1>format='xX9!'
1>? PIC(string,format)
abcd
1>format='X-X-X-X'
1>? PIC(string,format)
a-b-c-d
1>SET ZERO ON
1> ? 0,'|',str(0,5,2),'|',pic(0,'99.99'),'|','0'
0.00 | 0.00 | 0.00 | 0
1>SET ZERO OFF
1> ? 0,'|',str(0,5,2),'|',pic(0,'99.99'),'|','0'
| 0.00 | | 0
PIC( SRI VPI VPIN PIC(
SR-Info/VP-Info Reference Manual Page 91 SECTION 3
PIC( SRI VPI VPIN PIC(
SR-Info/VP-Info Reference Manual Page 92 SECTION 3
PRINTER(
Test whether a printer is ready to print.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β PRINTER([<printernum>]) β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β Option: β
β β
β <printernum> the number of the LPT port (1 or 2) β
βββββββββββββββββββ β
β Type: logical β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
Whenever a program has to print, it needs a printer turned on and
on-line. When it is unsuccessful in printing, SR-Info/VP-Info
intercepts the customary DOS error (the infamous "Abort, Retry,
Ignore?") and ends execution.
The PRINTER( function gives programmers a way to ensure the
printer is correctly set up before sending output to the screen. This
makes it possible to suspend execution under program control, prompt
for correction action, or even SPOOL the output to a disk file instead
of the printer.
Examples in programs:
DO WHILE .NOT. PRINTER()
WINDOW 10,10,15,69 DOUBLE
@ 12,10 SAY CEN('Turn on printer and press any key . . .',60)
RING
CURSOR 13,39
cc=INKEY()
WINDOW
ENDDO
IF .NOT. PRINTER(2) ;test LPT2
SPOOL printfil
ENDIF
IF PRINTER()
SET PRINT ON
ENDIF
PRINTER( SRI VPI VPIN PRINTER(
SR-Info/VP-Info Reference Manual Page 93 SECTION 3
PUT(
Puts a string into a DOS file.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β PUT(<str exp>[,filenum]) β
β β
β <str exp> the string to overwrite with β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β Option: β
β β
β <filenum> the DOS file number (between 1 and 4) β
βββββββββββββββββ β
β Type: logical β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
A DOS file was opened with the WOPEN( function; the character
number pointer was normally positioned with the SEEK( function. This
function overwrites the file from the character chosen by the
character number pointer with the string <str exp>.
If filenum is not given, filenum=1 is assumed. PUT( returns T if
successful, F otherwise.
See also the functions ROPEN(, WOPEN(, CLOSE(, SEEK(, and GET(.
Examples:
1>byte=CHR(13)
1>ok=WOPEN('test',3)
1>ok=SEEK(5221)
1>ok=PUT(byte,3)
PUT( SRI VPI VPIN PUT(
SR-Info/VP-Info Reference Manual Page 94 SECTION 3
RAND(
Gives a random number in the range 0<=n<1.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β RAND([<seed>]) β
β VP-Info Professional only β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β Option: β
β β
β <seed> a number used to initiate the random series β
βββββββββββββββββββ β
β Type: numeric β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
A series of successive calls to the RAND( function will return a
uniform distribution of random numbers.
The first time RAND( is called, <seed> -- any numeric expression
-- may be specified. All subsequent calls should be without the seed.
If no initial seed is provided, a random seed is chosen by the
program.
RAND( always returns a number equal to or greater than 0 and less
than 1. If you need a random series of integers between zero and
5000, use 5000*RAND().
Note: if you provide the initial seed, every execution of RAND()
will return the same series of numbers.
RAND( VPI VPIN RAND(
SR-Info/VP-Info Reference Manual Page 95 SECTION 3
RANK(
Converts a character to its ASCII number.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β RANK(<str exp>) β
β β
β <str exp> the first character of this string is converted β
βββββββββββββββββ β
β Type: numeric β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
The characters in the character set used by the computer are
numbered from 0 to 255. For the first character of the string
<str exp>, RANK( returns the corresponding number. See also the
function CHR(. See also the functions CHR(, CTONUM(, and NUMTOC(.
Examples:
1>? RANK('x')
120.00
1>? RANK('xyz')
120.00
Note that only the first character of the string matters.
RANK( SRI VPI VPIN RANK(
SR-Info/VP-Info Reference Manual Page 96 SECTION 3
READ(
Reads a line of a sequential file.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β READ(<str var>[,<filenum>]) β
β β
β <str var> stores the line read in β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β Option: β
β β
β <filenum> the DOS file number (between 1 and 4) β
βββββββββββββββββ β
β Type: logical β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
This function reads the next line of the sequential file (opened
with the ROPEN( function) into the string variable <str var>. If
<str var> does not exist, it will be created; <str var> cannot be a
matrix variable.
A line is terminated by the carriage return character (ASCII 13).
Since the line is read into a string variable, it cannot be longer
than 254 characters.
If filenum is not given, filenum=1 is assumed. READ( returns T
if successful, F otherwise.
In SR-Info/VP-Info programs, READ( normally appears in an IF or
DO WHILE command.
READ(, IN(, GET(, and WRAP( are the only functions that change
the contents of the memory variable used as an argument.
See Programming SR-Info/VP-Info for sequential file handling and
examples, and++ the functions WRITE(, ROPEN(, WOPEN(, CLOSE(, IN(,
OUT(, and SSEEK(.
Examples:
1. In Conversational SR-Info/VP-Info:
1>ok=ROPEN('a:label.prg')
1>ok=READ(line)
1>? line
2. Two programs to print a text file, TEST (in the second version
it is assumed that TEST has no more than 20 lines):
READ( SRI VPI VPIN READ(
SR-Info/VP-Info Reference Manual Page 97 SECTION 3
SET WIDTH TO 80
SET PRINT ON
IF ROPEN('test')
DO WHILE READ(line)
? line
ENDDO
ok=CLOSE()
ENDIF
DIM CHAR 80 matrix[20]
SET WIDTH TO 80
SET PRINT ON
IF ROPEN('test',1)
REPEAT 20 times VARYING num
IF READ(input,1)
matrix[num]=input,
ELSE
BREAK
ENDIF
ENDREPEAT
IF CLOSE(1)
? matrix
ENDIF
ENDIF
READ( SRI VPI VPIN READ(
SR-Info/VP-Info Reference Manual Page 98 SECTION 3
RECNO(
Gets the current record number in any open data file.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β RECNO([<filenum>]) β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β Option: β
β β
β <filenum> the number of any open data file; default is the β
β selected data file β
βββββββββββββββββ β
β Type: numeric β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
This function returns the record number of the current record of
any specified data file; if no <filenum> is given, returns the record
number the selected file. Note that ? RECNO() displays the current
record number in the form specified by the system variable :PICTURE
(see Section 2.7).
SR-Info/VP-Info also has a more limited form of this function,
RECNO(, which applies only to the selected data file.
Examples:
1>USE employee
1>USE#2 customer
1>? RECNO(1)
1.00
1>GO BOTTOM
1>? RECNO(1)
6.00
1>GO TOP
1>? RECNO()
1.00
1>SKIP#2 2
1>? RECNO(2)
3.00
RECNO( SRI VPI VPIN RECNO(
SR-Info/VP-Info Reference Manual Page 99 SECTION 3
REMLIB(
Removes a library entry.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β REMLIB(<volume>) β
β β
β <volume> the number of the library entry to be removed. β
βββββββββββββββββββ β
β Type: logical β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
This function deletes a library entry. The function accepts the
library volume number you wish to delete as its argument and returns T
(true) if the delete operation was successful, F (false) if not.
Once a library entry (volume) is deleted, its space in the
library is made available for new text.
Libraries are created with the SET LIBRARY TO command. See TEXT
and WRITE commands.
Example:
1>? REMLIB(50)
T
REMLIB( SRI VPI VPIN REMLIB(
SR-Info/VP-Info Reference Manual Page 100 SECTION 3
REPLACE(
Replaces, in a string expression, all occurrences of a string with
another string.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β REPLACE(<str exp>,<str exp1>,<str exp2>) β
β β
β <str exp> replace in this string expression β
β <str exp1> all occurrences of this string β
β <str exp2> with this string β
βββββββββββββββββββ β
β Type: character β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
This function looks up the first occurrence of <str exp1> in the
string <str exp>. This occurrence is replaced with <str exp2>. This
process continues as long as <str exp1> occurs in <str exp>.
Examples:
1. A field contains a number as right justified characters,
padded on the left with blanks. The following REPLACE( changes these
numbers to right justified numbers padded on the left with zeros.
1>number=' 123'
1>number=REPLACE(number,' ','0')
1>? number
00000123
2. In writing checks, dollar amounts may be left padded with
dollar signs:
1>number=' 123.11'
1>number=REPLACE(number,' ','$')
1>? number
$$$$$123.11
3. Renaming a variable in a program line. The variable OLDN is
renamed FIRSTNUMB.
1>line='newn=oldn+oldn+(oldn/3)'
1>line=REPLACE(line,'oldn','firstnumb')
1>? line
newn=firstnumb+firstnumb+(firstnumb/3)
REPLACE( SRI VPI VPIN REPLACE(
SR-Info/VP-Info Reference Manual Page 101 SECTION 3
RESET(
Sets a bit in a string to 0.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β RESET(<str exp>,<bit position>) β
β β
β <str exp> the string or string expression on which the β
β function is to act β
β <bit position> the number of the bit, numbered from the left β
β starting at 1, which is to be set to zero β
βββββββββββββββββ β
β Type: logical β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
A bit is any of the eight binary digits in a character's ASCII
number representation. Each bit can have only one of two possible
values, 0 and 1.
The SET( and RESET( functions are used to manipulate the bits
within a string or string expression. SET( makes a bit 1, and RESET(
makes a bit 0. The BIT( function tests the value of a specific bit.
Among the chief uses for these functions is compression of
logical (true/false) data by using just one bit for each data item
instead of an entire byte for a logical field or two bytes for a
logical variable.
See the BIT( function for programming examples.
Examples:
1>str='PS'
1>? BIT(str,15)
T
1>str=RESET(str,15)
1>? str,BIT(str,15)
PQ F
RESET( SRI VPI VPIN RESET(
SR-Info/VP-Info Reference Manual Page 102 SECTION 3
RIGHT(
Gets the right-hand part of a string.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β RIGHT(<str exp>, <num exp>) β
β β
β <str exp> the string from which the new string is formed β
β <num exp> the number of characters to place in the new string β
βββββββββββββββββββ β
β Type: character β β
βββββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββ
This function returns the last (that is, the rightmost) <num exp>
characters from the string <str exp>.
If <num exp> is greater than the width of <str exp>, this
function returns all of <str exp>.
Example:
1>a='David Bark'
1>? RIGHT(a,5)
Bark
1>? RIGHT(a,50)
David Bark
RIGHT( SRI VPI VPIN RIGHT(
SR-Info/VP-Info Reference Manual Page 103 SECTION 3
ROPEN(
Opens a DOS file for reading.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ROPEN(<str exp> [,filenum]) β
β β
β <str exp> the file name β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β Option: β
β β
β filenum the DOS file number (between 1 and 4) β
βββββββββββββββββ β
β Type: logical β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
This function opens <str exp>, a DOS file (in particular, a
sequential file or input device, such as COM1), for reading only. The
current position pointer (see the SEEK( function) is set to the
beginning of the file.
If filenum is not given, filenum=1 is assumed. If no file
extension is given, the extension TXT is used.
ROPEN( returns T if successful, F otherwise.
See the functions WOPEN(, CLOSE(, READ(, WRITE(, IN(, OUT(, GET(,
PUT(, SEEK(, and SSEEK(.
Examples:
1>? ROPEN('a:label.prg')
T
In a SR-Info/VP-Info program, ROPEN( normally appears in an IF
command:
IF ROPEN('file',2)
DO WHILE READ(data,2)
? data
ENDDO
ok=CLOSE(2)
ENDIF
ROPEN( SRI VPI VPIN ROPEN(
SR-Info/VP-Info Reference Manual Page 104 SECTION 3
ROW(
Gets print row position.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ROW() β
βββββββββββββββββ β
β Type: numeric β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
This function gives the current row (line) position of the
cursor; if the printer is on, it returns the column position of the
printer head. See the commands SET PRINT ON and SET FORMAT TO PRINT,
and the function COL(.
Example:
@ ROW()+1,COL()+3 SAY 'Hello'
prints 'Hello' starting on the next line three characters to the right
of the end of the last printing.
ROW( SRI VPI VPIN ROW(
SR-Info/VP-Info Reference Manual Page 105 SECTION 3
SEEK(
Goes to a given character number in a DOS file.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SEEK(<num exp> [,filenum]) β
β β
β <num exp> the character number β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β Option: β
β β
β <filenum> the DOS file number (between 1 and 4) β
βββββββββββββββββ β
β Type: logical β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
This function repositions the character number pointer in the DOS
file (opened with the ROPEN( or WOPEN( function) to the value given by
<num exp>.
If filenum is not given, filenum=1 is assumed. If no file
extension is given, the extension TXT is used.
If SEEK( is successful, it returns T (true); otherwise F (false).
In a SR-Info/VP-Info program, SEEK( normally occurs in an IF or DO
WHILE command.
Once the character pointer is properly positioned, use the GET(
and PUT( functions to manipulate the characters.
See the functions SSEEK(, ROPEN(, WOPEN(, CLOSE(, GET(, and PUT(.
Example:
1>ok=ROPEN('a:label.prg',4)
1>ok=SEEK(522,4)
SEEK( SRI VPI VPIN SEEK(
SR-Info/VP-Info Reference Manual Page 106 SECTION 3
SET(
Sets a bit in a string to 1.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SET(<str exp>,<bit position>) β
β β
β <str exp> the string or string expression on which the β
β function is to act β
β <bit position> the number of the bit, numbered from the left β
β starting at 1, which is to be set to 1 β
βββββββββββββββββ β
β Type: logical β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
A bit is any of the eight binary digits in a character's ASCII
number representation. Each bit can have only one of two possible
values, 0 and 1.
The SET( and RESET( functions are used to manipulate the bits
within a string or string expression. SET( makes a bit 1, and RESET(
makes a bit 0. The BIT( function tests the value of a specific bit.
Among the chief uses for these functions is compression of
logical (true/false) data by using just one bit for each data item
instead of an entire byte for a logical field or two bytes for a
logical variable.
See the BIT( function for programming examples.
Examples:
1>str='PQ'
1>? BIT(str,15)
F
1>str=RESET(str,15)
1>? str,BIT(str,15)
PS T
SET( SRI VPI VPIN SET(
SR-Info/VP-Info Reference Manual Page 107 SECTION 3
SPACE(
Gets the amount of space left in the data space.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SPACE() β
βββββββββββββββββ β
β Type: numeric β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
This function returns the available memory in the 64K data space
(see Appendix A).
Example:
1>SPACE()
27155.00
SPACE( SRI VPI VPIN SPACE(
SR-Info/VP-Info Reference Manual Page 108 SECTION 3
SSEEK(
Goes to a given line number in a sequential file.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SSEEK(<num exp> [,<filenum>]) β
β β
β <num exp> the line number β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ’
β Option: β
β β
β <filenum> the DOS file number (between 1 and 4) β
βββββββββββββββββ β
β Type: logical β β
βββββββββββββββββ§βββββββββββββββββββββββββββββββββββββββββββββββββββββ
This function repositions the line number pointer in the
sequential file (opened with the ROPEN( function) to the value given
by <num exp>.
If filenum is not given, filenum=1 is assumed. If no file
extension is given, the extension TXT is used.
If filenum is not given, filenum=1 is assumed. If no file
extension is given, the extension TXT is used.
See the functions SEEK(, ROPEN(, WOPEN(, CLOSE(, READ(, IN(, and
OUT(.
Example:
1>ok=ROPEN('a:label.prg',4)
1>line=''
1>ok=SSEEK(5,4)
1>? ok
T
1>ok=READ(line,4)
1>? line
GOTO top
1>ok=SSEEK(900,4)
1>? ok
F
SSEEK( SRI VPI VPIN SSEEK(